kogan / django-lrucache-backend Goto Github PK
View Code? Open in Web Editor NEWA local in-memory cache backend for Django
Home Page: https://devblog.kogan.com/
License: MIT License
A local in-memory cache backend for Django
Home Page: https://devblog.kogan.com/
License: MIT License
Benchmark the difference between OrderedDict and LRU has a backing dictionary for the cache.
Also update the docs since Django now uses an LRU culling strategy too.
I noticed your cache improves performance over Django locmem cache in two ways:
I think those features should remain the default in Django core but they may be nice options to add. Are you interested in integrating those as options into Django?
Since every read is actually a write (a read shifts the element to the back of the queue), then a read write lock is not sufficient. Further, RWLock is being deprecated from django core.
Remove reliance on RWLock and switch to threading.RLock.
See also #3 which will require a new set of benchmarks doing threaded benchmarking so that locks are engaged during testing.
FYI, the benchmark code is using multiple processes which doesn't stress the cache like multiple threads would. If you change mp.Process
to threading.Thread
then everything will run the same but you'll really stress the locks.
The 'Usage' paragraph of the readme contains a typo:
CACHES = {
'local': {
'BACKEND': 'lrucache_backend.LRUObjectCache',
'TIMEOUT': 600,
'OPTIONS': {
'MAX_ENTRIES': 100,
'CULL_FREQUENCY: 100,
},
'NAME': 'optional-name'
}
}
'CULL_FREQUENCY: 100,
is missing an apostrophe:
CACHES = {
'local': {
'BACKEND': 'lrucache_backend.LRUObjectCache',
'TIMEOUT': 600,
'OPTIONS': {
'MAX_ENTRIES': 100,
'CULL_FREQUENCY': 100,
},
'NAME': 'optional-name'
}
}
It looks like the pyproject.toml
lists the Django dependency as Django = "^1.11"
, which means I can't use poetry to add django-lrucache-backend
to a Django 2.x project.
The project read-me seems to indicate that Django 2.2 would be fine, but the pyproject.toml needs to be updated.
Here is my output when I try to add it to a Django 2.2 project:
[SolverProblemError]
Because django-lrucache-backend (2.0.0) depends on Django (>=1.11,<2.0)
and no versions of django-lrucache-backend match >2.0.0,<3.0.0, django-lrucache-backend (>=2.0.0,<3.0.0) requires Django (>=1.11,<2.0).
So, because my_project depends on both django (^2.2.7) and django-lrucache-backend (^2.0.0), version solving failed.
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.