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.3.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.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: minio_flask_cache-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 b774642a866013c65291436db48fe469745228411114cb910e9c0cfe06c653f2
MD5 c8a8bae5af2a4e6bb2fbba7e761e2ea1
BLAKE2b-256 07ebe470de059a9f2250a384a00546d9ec5bd162736cd1e51aeda0e4f6e7b520

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for minio_flask_cache-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9a34328252168978e2eef0a1061b249715445f271dd033bff534a611928e9fd2
MD5 2519f2f5d2121d33fa23b091a7d966da
BLAKE2b-256 17981229cfdd8dee7a02ed078197bb98ed9931784869aa00f91305f92010dd54

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