django-cachepurge
What is it?
This package allows django to purge HTTP cache when a model instance is changed or deleted. It does this by sending “PURGE” requests to one or more upstream HTTP cache (such as Squid or Varnish). This is inspired by Plone CacheFu components.
Usage
In settings.py put ‘django_cachepurge’ before any other application; else it may fail to register some models:
INSTALLED_APPS = ( 'django_cachepurge', ... )
Add the middleware:
MIDDLEWARE_CLASSES = (
...
'django_cachepurge.middleware.CachePurge',
)
Define CACHE_URLS:
CACHE_URLS = 'http://127.0.0.1:3128'
or if you have more than one cache:
CACHE_URLS = ('http://127.0.0.1:3128',
'http://192.168.1.42:3128')
Models
Urls are extracted from models instances on post_save signal. Two sources are used:
instance.get_absolute_url(), if it exists
instance.get_purge_urls(), if it exists. The application expects a list of absolute paths similar to what is provided by get_absolute_url().
Purge request is sent when response has been computed: if an exception occurs the urls are not purged. Purge requests are asynchronous: worker threads handle that so that we don’t have wait to complete all requests before returning the response.
Cache configuration
The cache must be configured to accept and handle “PURGE” requests from the server where the django application is hosted.
Homepage, code, bug tracker
Homepage: http://launchpad.net/django-cachepurge
Code repository: http://code.launchpad.net/django-cachepurge
Report bugs at http://bugs.launchpad.net/django-cachepurge
Contributors
Bertrand Mathieu, Author
Change history
0.3 - 2011-04-01
Compatible with Django 1.3: don’t import django.utils.thread_support
catch NoReverseMatch exception when trying to find an instance’s url
0.2 - 2010-11-22
Accept to purge only site urls, converted if needed into their relative form (i.e, “/some/path/”)
0.1a - 2009-05-25
0.1a: 0.1 released missed some files
Initial release
Download
Metadata
Release files for django-cachepurge 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-cachepurge-0.3.tar.gz | 10.0 kB | Without provenance | Details for django-cachepurge-0.3.tar.gz |
Release files / django-cachepurge-0.3.tar.gz
| Download URL | django-cachepurge-0.3.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
687b53cecb90dff45861ea022a193f691c04c4065c4e885179a44e7b4f1e4301
|
|
BLAKE2b-256 checksum How to use checksums |
02db6ae104f7ca883ecb381827cd85345261bb2f0b1de4eaaddefe23a07e3b8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-cachepurge 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.