Skip to main content

Caching plugin for fastack

Project description

fastack-cache

fastack-cache is a caching plugin for fastack ❤️

This plugin is inspired by the django cache framework and django-redis!

Supported cache backend:

  • Redis:
    • fastack_cache.backends.redis.RedisBackend - Sync version
    • fastack_cache.backends.aioredis.AioRedisBackend - Async version

Installation

pip install -U fastack-cache

Usage

Add the plugin to your project configuration:

PLUGINS = [
    "fastack_cache",
    ...
]

Configuration:

REDIS_HOST = "localhost"
REDIS_PORT = 6900
REDIS_DB = 0
CACHES = {
    # cache name
    "default": {
        # cache backend
        "BACKEND": "fastack_cache.backends.redis.RedisBackend",
        # Cache options to be passed to the Redis(...) class
        "OPTIONS": {
            "host": REDIS_HOST,
            "port": REDIS_PORT,
            "db": REDIS_DB,
        },
        # Serializer for converting data into cache
        "SERIALIZER": {
            "CLASS": "fastack_cache.serializers.JSONSerializer",
            "OPTIONS": {
                # Option to pass when dumps() method in serializer class is called
                "DUMPS": {},
                # Option to pass when loads() method in serializer class is called
                "LOADS": {}
            }
        }
    }
}

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

fastack-cache-1.2.0.tar.gz (7.3 kB view hashes)

Uploaded Source

Built Distribution

fastack_cache-1.2.0-py3-none-any.whl (10.8 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