Django-cache
Enhanced cache_page decorator for Django views.
Compatibility
Django-cache properly works with Django 1.8, 1.9, 1.10 and 1.11 on Python 2.7, 3.4, 3.5 and 3.6.
Advantages
fixed certain amount of bugs (including #15855)
support of callable
cache_timeoutandkey_prefixparameterscache age can be limited by client (min cache age is manageable, default is 0)
Usage
from djangocache import cache_page
@cache_page(cache_timeout=600)
def view(request):
pass
Combination with last_modified and/or etag view decorators
If you planning to use cache_page among with last_modified and/or etag the latter must be placed after cache_page:
from djangocache import cache_page
from django.views.decorators.http import last_modified, etag
def etag_generator(request, *args, **kwargs):
return 'ETag!!'
@cache_page(cache_timeout=600)
@etag(etag_generator)
def view(request, *args, **kwargs):
pass
Django Settings
DJANGOCACHE_MIN_AGE - used to set minimal age of cache. Default is 0, meaning that client can ask server to skip cache by providing header Cache-Control: max-age=0.
@cache_page params
cache_timeout. Default is settings.CACHE_MIDDLEWARE_SECONDS.
key_prefix. Default is settings.CACHE_MIDDLEWARE_KEY_PREFIX.
cache_alias. Default is settings.CACHE_MIDDLEWARE_ALIAS, or settings.DEFAULT_CACHE_ALIAS if set to None.
cache_min_age. Default is settings.DJANGOCACHE_MIN_AGE.
Installation
pip install --upgrade django-cache
Metadata
Release files for django-cache 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 | |
|---|---|---|---|---|
| django-cache-0.3.tar.gz | 4.7 kB | Without provenance | Details |
Release files / django-cache-0.3.tar.gz
| Download URL | django-cache-0.3.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
004885c0da998b2d0e11e40aede0c9054476010303ee9cf40f93d7e93ec9f1d0
|
|
BLAKE2b-256 checksum How to use checksums |
6608e8213959253f3062f20004d10364779b44e577c34c7dd3175cd723e37f75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-cache 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.