Skip to main content

disk_cache_data decorator

Project description

disk_cache_data decorator

Fully configurable decorator with functionnality as Streamlit st.cache_data with local disk storage as backend.

Installation

pip install mysiar-disk-cache-data

Usage

disk_cache_data

Configuration by environment variables:

  • DISK_CACHE_DISABLED=1 - disable caching
  • DISK_CACHE_DEBUG=1 - enable debug logging (currently by print statements)
  • DISK_CACHE_DIR=/path/to/cache/dir - set custom cache directory (default is /tmp/disk_cache)
  • DISK_CACHE_NAMESPACE - subfolder for namespacing (default is disk_cache)
from mysiar.disk_cache_data import disk_cache_data

@disk_cache_data(ttl="30s")
def load_data(a, b):
    return a + b

# first call is whole function process
result = load_data(1, 2)
# each next call within ttl is cached
result = load_data(1, 2)

disk_cache_cleanup

Function to cleanup expired cache files.

from mysiar.disk_cache_data import disk_cache_cleanup
disk_cache_cleanup()

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

mysiar_disk_cache_data-0.0.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

mysiar_disk_cache_data-0.0.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file mysiar_disk_cache_data-0.0.1.tar.gz.

File metadata

  • Download URL: mysiar_disk_cache_data-0.0.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for mysiar_disk_cache_data-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6db80bd9f4b5c3eb014dd43e1bc891f23feb83f621a746ac0f4a799c1d89975e
MD5 70f603078ae283f3d1220772de49c954
BLAKE2b-256 32faa8350d2c9b2265104705e0936af8c53cf847b168ce93b18b32ed05f1a803

See more details on using hashes here.

File details

Details for the file mysiar_disk_cache_data-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mysiar_disk_cache_data-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7cd32c059b3f79769ca060e777f185f6faf264fd9fc3688315a2092b53b36cc
MD5 346bdf422f9d57f32f3b6e3a74b2aefc
BLAKE2b-256 35939d4c361ab6bd7b33fdba763daa5905f83b2f082d1473648b74fc56cf07b9

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