django-dynamodb-cache


Namedjango-dynamodb-cache JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/xncbf/django-dynamodb-cache
Summary
upload_time2024-01-28 12:33:11
maintainer
docs_urlNone
authorxncbf
requires_python>=3.8,<4.0
licenseMIT
keywords django dynamodb cache django cache backend
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-dynamodb-cache

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

<p align="center">
<a href="https://github.com/xncbf/django-dynamodb-cache/actions/workflows/tests.yml" target="_blank">
    <img src="https://github.com/xncbf/django-dynamodb-cache/actions/workflows/tests.yml/badge.svg" alt="Tests">
</a>
<a href="https://codecov.io/gh/xncbf/django-dynamodb-cache" target="_blank">
    <img src="https://img.shields.io/codecov/c/github/xncbf/django-dynamodb-cache?color=%2334D058" alt="Coverage">
</a>
<a href="https://pypi.org/project/django-dynamodb-cache" target="_blank">
    <img src="https://img.shields.io/pypi/v/django-dynamodb-cache?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://pypi.org/project/django-dynamodb-cache" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/django-dynamodb-cache.svg?color=%2334D058" alt="Supported Python versions">
</a>
<a href="https://pypi.org/project/django-dynamodb-cache" target="_blank">
    <img src="https://img.shields.io/pypi/djversions/django-dynamodb-cache.svg" alt="Supported django versions">
</a>
<a href="http://pypi.python.org/pypi/django-dynamodb-cache/blob/main/LICENSE" target="_blank">
    <img src="https://img.shields.io/github/license/xncbf/django-dynamodb-cache?color=gr" alt="License">
</a>
</p>

- [django-dynamodb-cache](#django-dynamodb-cache)
  - [Introduce](#introduce)
  - [Why should I use this?](#why-should-i-use-this)
  - [Installation](#installation)
  - [Setup on Django](#setup-on-django)
  - [Aws credentials](#aws-credentials)
  - [Create cache table command](#create-cache-table-command)
  - [Future improvements](#future-improvements)
  - [How to contribute](#how-to-contribute)
    - [Debug](#debug)

## 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.
- 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

```sh
pip install django-dynamodb-cache
```

## Setup on Django

On Django `settings.py`

```python


INSTALLED_APPS = [
    ...
    "django_dynamodb_cache"
]

CACHES = {
    "default": {
        "BACKEND": "django_dynamodb_cache.backend.DjangoCacheBackend",
        "LOCATION": "table-name",                  # (mandatory)
        "TIMEOUT": 300,                            # (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

```zsh
python manage.py createcachetable
```

## Future improvements

In this project, the following can be improved in the future.

- A full scan is included to achieve `cache.clear()`.
This can lead to performance degradation when there is a lot of cached data.


## 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.

### Debug

Tests must be run in a sandbox environment.

To run the Dynamodb sandbox:
```
docker compose up --build
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xncbf/django-dynamodb-cache",
    "name": "django-dynamodb-cache",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "django,dynamodb,cache,django cache backend",
    "author": "xncbf",
    "author_email": "xncbf12@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/78/74/61343ac47b5149cb9cb5fd988615bcd21c61e7f192c2aab766690dd7b2d1/django_dynamodb_cache-0.6.0.tar.gz",
    "platform": null,
    "description": "# django-dynamodb-cache\n\nFast, safe, cost-effective DynamoDB cache backend for Django\n\n<p align=\"center\">\n<a href=\"https://github.com/xncbf/django-dynamodb-cache/actions/workflows/tests.yml\" target=\"_blank\">\n    <img src=\"https://github.com/xncbf/django-dynamodb-cache/actions/workflows/tests.yml/badge.svg\" alt=\"Tests\">\n</a>\n<a href=\"https://codecov.io/gh/xncbf/django-dynamodb-cache\" target=\"_blank\">\n    <img src=\"https://img.shields.io/codecov/c/github/xncbf/django-dynamodb-cache?color=%2334D058\" alt=\"Coverage\">\n</a>\n<a href=\"https://pypi.org/project/django-dynamodb-cache\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/v/django-dynamodb-cache?color=%2334D058&label=pypi%20package\" alt=\"Package version\">\n</a>\n<a href=\"https://pypi.org/project/django-dynamodb-cache\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/pyversions/django-dynamodb-cache.svg?color=%2334D058\" alt=\"Supported Python versions\">\n</a>\n<a href=\"https://pypi.org/project/django-dynamodb-cache\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/djversions/django-dynamodb-cache.svg\" alt=\"Supported django versions\">\n</a>\n<a href=\"http://pypi.python.org/pypi/django-dynamodb-cache/blob/main/LICENSE\" target=\"_blank\">\n    <img src=\"https://img.shields.io/github/license/xncbf/django-dynamodb-cache?color=gr\" alt=\"License\">\n</a>\n</p>\n\n- [django-dynamodb-cache](#django-dynamodb-cache)\n  - [Introduce](#introduce)\n  - [Why should I use this?](#why-should-i-use-this)\n  - [Installation](#installation)\n  - [Setup on Django](#setup-on-django)\n  - [Aws credentials](#aws-credentials)\n  - [Create cache table command](#create-cache-table-command)\n  - [Future improvements](#future-improvements)\n  - [How to contribute](#how-to-contribute)\n    - [Debug](#debug)\n\n## Introduce\n\nThis project is a cache backend using aws dynamodb.\n\nThis is compatible with the django official cache framework.\n\nDid you set the boto3 permission?\n\nEnter the django official command createcachetable and get started easily.\n\n## Why should I use this?\n\n- There are few management points, because dynamodb is a fully managed service.\n- Because you only pay for what you use, it saves money on light projects such as side projects or back offices.\n- If you need more performance, you can easily switch to DAX.\n\n## Installation\n\n```sh\npip install django-dynamodb-cache\n```\n\n## Setup on Django\n\nOn Django `settings.py`\n\n```python\n\n\nINSTALLED_APPS = [\n    ...\n    \"django_dynamodb_cache\"\n]\n\nCACHES = {\n    \"default\": {\n        \"BACKEND\": \"django_dynamodb_cache.backend.DjangoCacheBackend\",\n        \"LOCATION\": \"table-name\",                  # (mandatory)\n        \"TIMEOUT\": 300,                            # (optional) seconds\n        \"KEY_PREFIX\": \"django_dynamodb_cache\",     # (optional)\n        \"VERSION\": 1,                              # (optional)\n        \"KEY_FUNCTION\": \"path.to.function\",        # (optional) f\"{prefix}:{key}:{version}\"\n        \"OPTIONS\": {\n            \"aws_region_name\": \"us-east-1\",                    # (optional)\n            \"aws_access_key_id\": \"aws_access_key_id\",          # (optional)\n            \"aws_secret_access_key\": \"aws_secret_access_key\",  # (optional)\n            \"is_on_demand\": False,                 # (optional) default: True\n            \"read_capacity_units\": 1,              # (optional)\n            \"write_capacity_units\": 1,             # (optional)\n            \"encode\": \"django_dynamodb_cache.encode.PickleEncode\"  # (optional)\n        }\n    }\n}\n```\n\n## Aws credentials\n\nThe same method as configuring-credentials provided in the boto3 documentation is used.\n<https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials>\n\n## Create cache table command\n\nRun manage command to create cache table on Dynamodb before using\n\n```zsh\npython manage.py createcachetable\n```\n\n## Future improvements\n\nIn this project, the following can be improved in the future.\n\n- A full scan is included to achieve `cache.clear()`.\nThis can lead to performance degradation when there is a lot of cached data.\n\n\n## How to contribute\n\nThis project is welcome to contributions!\n\nPlease submit an issue ticket before submitting a patch.\n\nPull requests are merged into the main branch and should always remain available.\n\nAfter passing all test code, it is reviewed and merged.\n\n### Debug\n\nTests must be run in a sandbox environment.\n\nTo run the Dynamodb sandbox:\n```\ndocker compose up --build\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "",
    "version": "0.6.0",
    "project_urls": {
        "Homepage": "https://github.com/xncbf/django-dynamodb-cache",
        "Repository": "https://github.com/xncbf/django-dynamodb-cache"
    },
    "split_keywords": [
        "django",
        "dynamodb",
        "cache",
        "django cache backend"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "63507da0def21391e7b80e46accc50a241242fe888f5c182fec99a2c2f5507db",
                "md5": "171f50be9f10758d0ece4d850c1a5fc6",
                "sha256": "a3b39a710ff3decb9ad53de2206ccad92bcb75420743d89c6de27e77481b4f49"
            },
            "downloads": -1,
            "filename": "django_dynamodb_cache-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "171f50be9f10758d0ece4d850c1a5fc6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 12147,
            "upload_time": "2024-01-28T12:33:09",
            "upload_time_iso_8601": "2024-01-28T12:33:09.539108Z",
            "url": "https://files.pythonhosted.org/packages/63/50/7da0def21391e7b80e46accc50a241242fe888f5c182fec99a2c2f5507db/django_dynamodb_cache-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "787461343ac47b5149cb9cb5fd988615bcd21c61e7f192c2aab766690dd7b2d1",
                "md5": "bb694e3ef9d3fb33e971f05a0362da0d",
                "sha256": "0082055cf1c7e2676c48bdca2fbdc1491c14fcb54fb5dfb339c5956e9ecae354"
            },
            "downloads": -1,
            "filename": "django_dynamodb_cache-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bb694e3ef9d3fb33e971f05a0362da0d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 11018,
            "upload_time": "2024-01-28T12:33:11",
            "upload_time_iso_8601": "2024-01-28T12:33:11.139655Z",
            "url": "https://files.pythonhosted.org/packages/78/74/61343ac47b5149cb9cb5fd988615bcd21c61e7f192c2aab766690dd7b2d1/django_dynamodb_cache-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-28 12:33:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xncbf",
    "github_project": "django-dynamodb-cache",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-dynamodb-cache"
}
        
Elapsed time: 0.18403s