Comments (2)
Hi SantjagoCorkez,
I think you can't just strip self
out from the cache_key
, since different instances probably will return different values even for the same method. I believe this is the default use case.
Probably in your case you need something different from this, so I think you can create your own decorator around cache_it
decorator. If you need help for doing this, please let me know.
from redis-simple-cache.
Well, in my case the solution just strips out the first function arg. No matter what is it: self, cls or any generic argument as in staticmethod. And this guarantees no side effects in my case, because instance's self
contains no information that could cause difference between instance of class A(B) and class C(B), where B inits only logger.
As I've said, that could be specially marked in documentation as 'think twice when you use this argument'.
As for more generic solution this could be also implemented as strip_args=0
argument for decorator and pickle.dumps(args[strip_args:])
in code. That could help when one needs to exclude some N-first args of a function from cache entry's hash key.
from redis-simple-cache.
Related Issues (14)
- The prefix depends on the id of the SimpleCache object. HOT 2
- cache_it and cache_it_json will not properly cache methods that use keyword args HOT 1
- Installing package downgrades redis python library HOT 4
- SimpleCache.store() uses SETEX which cannot accept non-positive values HOT 2
- Impossible to select redis db HOT 5
- Infinite limit
- expire keys
- some ut failed HOT 1
- Cache Initial Conditions [Feature Request] HOT 6
- Support python 3 HOT 1
- Not used the parameter namespace on cache_it_json function
- Optional keyword to forcibly bypass cache HOT 1
- Ranges of keys HOT 15
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 redis-simple-cache.