Comments (3)
I don't think it's worthwhile to build something specifically for the Admin. Not many people use it.
What I do in my own use of django-fancy-cache is that I know a certain key to use in my prefix.
E.g.
@receiver(post_save, sender=LogEntry, dispatch_uid="clear_fancy_cache")
def clear_fancy_cache(sender, instance, **kwargs):
cache_key = 'mykey-%s' % instance.id
cache.delete(cache_key)
and in my key_prefixer, I have something like this:
def key_prefixer(request):
model = MyModel.objects.get(slug=request.path)
return 'mykey-%s' % model.id
You can see more in code for my blog.
from django-fancy-cache.
I can agree about building something specifically for the Admin, but your key prefix solution doesn't handle cache invalidation when a model changes, for this reason I continue to think that it would be very useful to have the possibility to do something that observe models post_save.
from django-fancy-cache.
It does handle cache invalidation when the model changes. As soon as the post_save
signal triggers the relevant views that depend on that model immediately invalidate.
from django-fancy-cache.
Related Issues (20)
- RemovedInDjango110Warning for OptionParser usage in management command HOT 4
- RemovedInDjango110Warning for url patterns in stats views HOT 1
- Tag latest release HOT 1
- Does this work with CBVs? All of the examples are old-style Django HOT 3
- FANCY_REMEMBER_ALL_URLS option and performance over time HOT 8
- Can fancy-cache send expires date on response header? HOT 1
- integrate this to official django HOT 1
- Consider keeping blank querystring values HOT 2
- Add support for Django 3.1 HOT 2
- Update CI to use GitHub Actions HOT 1
- [Suggestion] Use stale-bot or just close all issues 2016 and earlier HOT 1
- Format all code with Black and make that part of CI HOT 2
- Update django-fancy-cache on PyPI HOT 1
- Fancy cache does not work with django-rest-framework HOT 2
- fancy cache does not work HOT 3
- Timeout should be optional
- Client side caching may be overriding cache invalidation HOT 5
- PyPy tests are flaky
- Race condition with find_urls' purge=True HOT 1
- Incompatible with django 4.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-fancy-cache.