Skip to main content

A custom cache backend for Flask-Caching based on Minio. Usable for applications like Superset as a cache backend out of the box.

Project description

Minio Cache

A custom cache backend for Flask-Caching based on Minio. Usable for applications like Superset as a cache backend out of the box.

Installation

Simply install with pip !

pip install minio-flask-cache

Usage

Classic flask app

from flask import Flask
from flask_caching import Cache

app = Flask(__name__)
app.config['CACHE_TYPE'] = 'minio_cache.MinioCacheBackend'
app.config['CACHE_MINIO_ENDPOINT'] = 'localhost:9000'
app.config['CACHE_MINIO_ACCESS_KEY'] = 'minioadmin'
app.config['CACHE_MINIO_SECRET_KEY'] = 'minioadmin'
app.config['CACHE_MINIO_BUCKET'] = 'flask-cache'
app.config['CACHE_MINIO_SECURE'] = False  # Set to True for HTTPS
app.config['CACHE_DEFAULT_TIMEOUT'] = 300

cache = Cache(app)

Superset cache backend

See Superset Docs for more details on superset cache backends. Edit superset_config.py to add/edit the CACHE_CONFIG dict. Config can be used for all cache configurations (FILTER_STATE_CACHE_CONFIG, EXPLORE_FORM_DATA_CACHE_CONFIG, CACHE_CONFIG and DATA_CACHE_CONFIG).

CACHE_CONFIG = {
    "CACHE_TYPE": "minio_cache.MinioCacheBackend",
    "CACHE_MINIO_ENDPOINT": "localhost:9000",
    "CACHE_MINIO_ACCESS_KEY": "minioadmin",
    "CACHE_MINIO_SECRET_KEY": "minioadmin",
    "CACHE_MINIO_BUCKET": "superset",
    "CACHE_MINIO_SECURE": False  # Set to True for HTTPS,
    "CACHE_DEFAULT_TIMEOUT": 300,
    "CACHE_KEY_PREFIX": "superset_"
}

Contributions

Contributions are welcome. Project is tested with pytest, please make sure to adjust tests if necessary.

Licence

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

minio_flask_cache-0.0.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

minio_flask_cache-0.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file minio_flask_cache-0.0.2.tar.gz.

File metadata

  • Download URL: minio_flask_cache-0.0.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for minio_flask_cache-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8df13a252f78e647fe070507955e88e3cd9f89e5b784124f3fcb4f8ba140bcc1
MD5 3298337baca587237e19506db617ccc0
BLAKE2b-256 c62a30724ce4fe5f0887c18d567263dcf5dd13718f7129ea8941e83229c2e962

See more details on using hashes here.

File details

Details for the file minio_flask_cache-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for minio_flask_cache-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f38907316eab8465121e7e6294239816f5dc622c9e1de7aac3cf8a8547ad953f
MD5 f8f1280dd0192c4c99393fcfeb772e84
BLAKE2b-256 6029a76efc4f93572679f51fa5fc5d114bd52a396564d3abff0c89323af2f3e0

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