Comments (3)
Hmm, I don't really see how since accessing the property will access the underlying value. There's no handy way to add the bust()
method if you see what I'm saying. So:
class MyObject(object):
@cache.cached_property()
def the_func(self):
return 'hello'
obj = MyObject()
obj.the_func # Accesses the cache
obj.the_func.bust() # Not possible since the returned value is whatever was in the cache.
If you want bust
you'll probably just need the regular decorator.
from walrus.
Appreciate the quick response. I'm quite the Python newbie, so I had to go back and better understand properties in general. Perhaps I should be asking something else.
Would it be possible to use 'deleting' the cached property and have that effectively bust() the cache.
del obj.the_func
or the equivalent...
delattr(obj, 'the_func')
from walrus.
Yes, del obj.the_func should actually work. Reopening, thanks for the great idea.
from walrus.
Related Issues (20)
- cache.cached doesn't work if the function returns None HOT 1
- "lock.event:" pollution HOT 2
- [feature]Any plan for supporting model relationship mapping? HOT 1
- Consumer group pending exception HOT 1
- VSCode type checking can't identify RedisPy's Redis as parent HOT 2
- Database() is falsy when database is empty HOT 2
- Empty queries in graph HOT 1
- A problem with query in graph.py HOT 1
- Lock event keys never expire HOT 1
- There is a problem. HOT 3
- Walrus Support for Redis Python Client 4.x+ HOT 2
- Is Expiring Hashes supported in Walrus? HOT 3
- Missing argument in method calling
- Support from_url database connection HOT 2
- Extending Containers with custom behavior HOT 1
- Not compatible with Redis Python Client 5.0.0 HOT 5
- examples in docs use Python 2 syntax
- Handling json HOT 3
- regex error HOT 1
- regex syntax warning
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from walrus.