Skip to main content

Add your description here

Project description

Django FunCache

A Django app providing function-level caching with parameter-based keys and fixes for temporary file permissions.

Features

  • Function-level caching with parameter-based cache keys
  • Automatic cache key invalidation
  • Compatible with Python 2.7 and Python 3.x
  • Works with Django 1.11 and higher

Installation

# Using pip
pip install django-funcache
# Using uv
uv add django-funcache

Add to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'funcache',
    ...
]

Usage

Function Caching

Set the cache key prefix for a specific model or a set of models to invalidate the cache when the model datas are updated.

from funcache import func_cache
# Using for a specific model
@func_cache(key_prefix='my_model')
def expensive_function(param1, param2):
    # Function code here
    return result

# Using for a set of models
@func_cache(key_prefix=['my_model1', 'my_model2'])
def expensive_function(param1, param2):
    # Function code here
    return result

The cache invalidator is managed by the funcache app through a signal.

Settings

You can customize the cache timeout:

# In settings.py
CACHE_TIMER = 1800  # 30 MINUTES (default is 1800 seconds/30 minutes)

Python 2 and 3 Compatibility

This package works with both Python 2.7 and Python 3.x environments. It's tested with:

  • Python 2.7 with Django 1.11
  • Python 3.6+ with Django 2.2, 3.2, and 4.x

License

MIT

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_funcache-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_funcache-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file django_funcache-0.1.0.tar.gz.

File metadata

  • Download URL: django_funcache-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for django_funcache-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c91caa814b9a835057fd7159ee3664aceb075fecf52a09a2ad7fc3e51ef12662
MD5 371ad6ce4232c643b37dc4c25503898f
BLAKE2b-256 81e307ce8d95cde70a242ead4aaf9e891f73a229e900b302dd067c6b096affaf

See more details on using hashes here.

File details

Details for the file django_funcache-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_funcache-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a4795f9a7042d7ae817cd4627734448abff537e2199c7f5b4830166dbb7ea98
MD5 977c83578df0392adbb0299c8a1e6a0f
BLAKE2b-256 27e4a789b642be39fa6854e7c551877d036e71358c722a74e80530d19b9113a8

See more details on using hashes here.

Supported by

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