Comments (7)
I agree this is a useful feature. Thank you for the code snippet. Pull request welcome.
from python-diskcache.
You might want to use Django caches .get_many()
/.set_many()
interface, just to not add new one :)
from python-diskcache.
Do get_many and set_many operations have to hit database only once?
from python-diskcache.
Can't see if that is important, this should obviously be more efficient than a cycle of gets or sets, but otherwise implementation could be arbitrary.
from python-diskcache.
As I've thought about it, I doubt you could do get_many
or set_many
in a single database query but you could do them in a single database transaction. The database should be smart about which pages it updates and syncs.
So, yes, those methods should use a single database transaction.
Also, I don't think any batching should be done inside those methods. I want batching left to the end-user. If we give them an API like I've described above then the end-user can easily batch keys/values (as they may want in the case where the number of keys/values is very large). Not batching will block concurrent writers but the scenario is similar to writing a large value.
from python-diskcache.
In v4, diskcache will support transactions. There will be a tutorial section on transactions that will show how to do the *-many variants in one transaction.
from python-diskcache.
The set_many
example was added to the Transactions section of the tutorial at 126b033
from python-diskcache.
Related Issues (20)
- Mark the distributed package as typed HOT 1
- Long-lived cache management HOT 2
- PR for fork deadlock HOT 1
- Can this awasome add the range selection Feature? HOT 2
- PicklingError: logger cannot be pickled HOT 6
- Q: Config for in-memory shared cache HOT 8
- Use local OS' path separator HOT 3
- Cannot change JSONDisk compression level HOT 2
- Memoize key isn't always invertible
- support pandas.DataFrame in cache.memoize()
- Protect Against Repeated KeyboardInterrupt Signals HOT 1
- Error during reset
- Custom serializer cannot return "None"
- Bug with pandas 2.0 HOT 1
- Retrieve cached file path instead of bytes HOT 1
- Comparison with RocksDict HOT 3
- ImportError: DLL load failed while importing _sqlite3: The specified module could not be found.
- Add typing HOT 1
- Passing ignore arguments to memoized cache from local scope (diskcache python)
- Cache access fails after forking if multiple `Cache` instances are backed by the same database HOT 2
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 python-diskcache.