Skip to main content

A customizable implementation of Django's cache_page decorator.

Project description

A flexible implementation of Django's [`cache_page`](https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache) decorator.

# Description

This package provides two default ways to generate cache keys:
- generate_cache_key: similar to Django's default
- generate_query_params_cache_key

And allows you to define your custom key generation functions.



# Installation

```bash
pip install django-custom-cache-page
```

# Example


views.py:

```python
from django.http import HttpResponse

from custom_cache_page.cache import cache_page
from custom_cache_page.utils import generate_query_params_cache_key

@cache_page(60 * 60, generate_query_params_cache_key)
def my_view(request):
return HttpResponse("okay")
```

---

## Development installation

```bash
git clone https://github.com/zidsa/django-custom-cache-page.git
cd django-custom-cache-page
pip install --editable .
```



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-custom-cache-page-0.2.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

django_custom_cache_page-0.2-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page