Comments (2)
After a little more digging, I've found that invalidating tables doesn't actually delete any keys from cache. It waits for LRU to evict old keys, which is most efficient (no use deleting keys in practice). However, it does make it really hard to determine how much space Django-Cachalot requires in production to operate at maximum efficiency. What about adding a table prefix to each cache_key, and then build a management function that deletes all expired cachalot keys? This would be very inefficient, but could be used sparingly to understand how much space cachalot is actually using.
from django-cachalot.
First of all, you should set the memcached memory limit. Once it’s set, there’s no surprise: it will not take more than what you allow. And therefore no need for profiling.
Now, it would indeed be great to have better tools for profiling caches. Unfortunately, caches absolutely don’t work like a database, and that’s the cost for being as fast as possible. The only reliable thing with a cache is: asking for what’s stored at a certain key, and set the value for a certain key. Forget what you think you know about timeouts etc: none of it is reliable. If you create a key with an infinite timeout, it can very well be removed before a key with a 1 second timeout (if you want to know more about it, read this article in the Redis docs).
I’m sorry, but there’s no viable solution to make a command that deletes expired cachalot keys. I know it could be possible using Redis (or using other caches with non-standard hacks), but that would take hours on a big cache…
However, because tons of people requested it, I will add a way to specify cachalot’s timeout in the upcoming major release… For me, there is no good reason to use it, configuring properly the cache backend is the solution, not using a timeout that doesn’t work as 99.5% people think it does. But if users feel at home by having it…
from django-cachalot.
Related Issues (20)
- Does not support Django 4.1 HOT 3
- Allow enum-likes in CACHABLE_PARAM_TYPES HOT 1
- Tables defined in CACHALOT_UNCACHABLE_APPS are still being cached
- UncachableQuery raised when exporting models of table even if listed in `CACHALOT_UNCACHABLE_APPS`. HOT 3
- Does django-cachalot lib support the new django.core.cache.backends.redis.RedisCache cache backend in Django version 4.0? HOT 4
- using override_settings(CACHALOT_ENABLED=False) has no effect HOT 2
- Using timestamps considered harmful HOT 2
- NoneType error when saving UserProfileAdmin after Django 4.1 update
- Support Django 4.2
- Docs are not getting rendered correctly
- Update records after bulk_update many objects
- Is there a recommended way to turn off cachalot on a production DB without any downtime? HOT 2
- Why is my cache not invalidated? HOT 1
- Msssql future support HOT 2
- Cachalot tries to create a database connection on import HOT 4
- If redis is unavailable during migration, migration is applied but not inserted into migration table.
- Patched cursor does not expect psycopg2 sql Composed Object HOT 4
- Django 5 support HOT 2
- Renew timeout when query is accessed via cache
- Query which filters on annotation of second query does not have cache invalidated HOT 1
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 django-cachalot.