alexk307 / cache_deco Goto Github PK
View Code? Open in Web Editor NEWBackend agnostic cache decorator
License: MIT License
Backend agnostic cache decorator
License: MIT License
Cached values seem to be always retrieved and returned with type str
. This can be a problem when a function is expected to return an int
for example.
>>> mytest.my_method(2,3,2) # cache miss
512
>>> mytest.my_method(2,3,2) # cache hit
'512'
What would be the best way to force a certain return type?
By using your own hand-rolled connection to redis you cut off using unix domain sockets and taking advantage of other features of redis. This cache looks nice, but there is no reason for you to be making your own interface to redis.
Currently we only support Redis as the backend (as it's the name of the project), but I think it would be helpful to make it able to extend to any backend.
We would probably want some sort of backend abstract class.
Line 5 in 75956ee
As the note says in the README it is necessary to override the calling object's str method as well as any objects passed into the function as parameters. This doesn't seem maintainable. We will have to create a way to do this behind the implicitly.
There is currently no way to bust the cache on demand. This is a bit difficult with the current implementation because it caches based on a hash of the signature. There should either be a method to bust the cache when calling a function, or some sort of control passed into the decorator itself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.