Serverless cache backend for Django and Flask
Working with: AWS Dynamodb
pip
pip install lesscache
pipenv
pipenv install lesscache
On Django Settings
instaled_apps = [
...
'lesscache.compact.django'
]
CACHES = {
'default': {
'BACKEND': 'lesscache.compact.django.cache.DjangoCacheDynamodb',
'TIMEOUT': 120 # default 120 seconds == 2minutes
'KEY_PREFIX': 'less' # default less
'VERSION': 1 # default 1
'KEY_FUNCTION': 'path.to.function' # f'{prefix}:{key}:{version}'
'OPTIONS': {
'aws_access_key_id': None # need only if you dont have login
'aws_secret_access_key': None # on aws-cli with your key
'aws_region_name': None # or not in aws lambda
'read_capacity_units': 1
'write_capacity_units': 1
'encode': 'path.to.encode' # default: 'lesscache.encode.PickleEncode
}
}
}
Run manage command to create cache table on Dynamodb before using
python manage.py create_dynamodb_cache
WIP
WIP