Skip to main content

No project description provided

Project description

django-dynamodb-cache

Fast, safe, cost-effective DynamoDB cache backend for Django

Tests Coverage Package version Supported Python versions Supported django versions License

Introduce

This project is a cache backend using aws dynamodb.

This is compatible with the django official cache framework.

Did you set the boto3 permission?

Enter the django official command createcachetable and get started easily.

Why should I use this?

  • There are few management points, because dynamodb is a fully managed service.
  • Data is safely stored unlike inmemory db.
  • Because you only pay for what you use, it saves money on light projects such as side projects or back offices.
  • If you need more performance, you can easily switch to DAX.

Installation

pip install django-dynamodb-cache

Setup on Django

On Django settings.py

INSTALLED_APPS = [
    ...
    "django_dynamodb_cache"
]

CACHES = {
    "default": {
        "BACKEND": "django_dynamodb_cache.backend.DjangoCacheBackend",
        "LOCATION": "table-name",                  # (mandatory)
        "TIMEOUT": 120,                            # (optional) seconds
        "KEY_PREFIX": "django_dynamodb_cache",     # (optional)
        "VERSION": 1,                              # (optional)
        "KEY_FUNCTION": "path.to.function",        # (optional) f"{prefix}:{key}:{version}"
        "OPTIONS": {
            "aws_region_name": "us-east-1",                    # (optional)
            "aws_access_key_id": "aws_access_key_id",          # (optional)
            "aws_secret_access_key": "aws_secret_access_key",  # (optional)
            "is_on_demand": False,                 # (optional) default: True
            "read_capacity_units": 1,              # (optional)
            "write_capacity_units": 1,             # (optional)
            "encode": "django_dynamodb_cache.encode.PickleEncode"  # (optional)
        }
    }
}

Aws credentials

The same method as configuring-credentials provided in the boto3 documentation is used. https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials

Create cache table command

Run manage command to create cache table on Dynamodb before using

python manage.py createcachetable

How to contribute

This project is welcome to contributions!

Please submit an issue ticket before submitting a patch.

Pull requests are merged into the main branch and should always remain available.

After passing all test code, it is reviewed and merged.

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

enkonix-django-dynamodb-cache-0.3.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file enkonix-django-dynamodb-cache-0.3.1.tar.gz.

File metadata

File hashes

Hashes for enkonix-django-dynamodb-cache-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a93a7d0d7d865490656b5557cec0cd798283a802897c975c8cd56fcbc2afdb10
MD5 91c6f6f6a5a237e660b977a117cec981
BLAKE2b-256 eff73620566f0c572f038d11aa966ea5a0dd8d2b71d8a01ee61a4e06e3cece4f

See more details on using hashes here.

File details

Details for the file enkonix_django_dynamodb_cache-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for enkonix_django_dynamodb_cache-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5a24775f3e6521e0e7e60b4060a649debe3af64f5d4403af47efff87b91f3eb
MD5 67f2168a78c3631823ca70017880a2f7
BLAKE2b-256 f7f1a468da920701620e07c8a524a11443b71d2fe761a016cf2f7d3a0b13a088

See more details on using hashes here.

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