Skip to main content

No project description provided

Project description

CACHE GUIOSOFT

Caching data using files, Redis or local SQLite

codecov Codecov push

[codecov]

Upload Python Package

Local files for caching

from cache_gs import CacheGS

# Storage on local directory

file_cache = CacheGS('path://directory_for_cache_storage')

# Storage on local SQLite database

slite_cache = CacheGS('sqlite://directory_or_file_for_storage')

# Storage on Redis

redis_cache = CacheGS('redis://host:6379?arg=value&arg2=value2')

Usage

Like INI files, data is grouped in section/key names.

Writing value

cache.set_value(section, key, value, valid_until: int = 0, expires_in: int = 0)

# valid_until is a real timestamp 
# expires_in is the life time of value in seconds from the time is created

Reading value

value = cache.get_value(section, key, default=None)

Deleting value

cache.delete_value(section, key)

Purging expired data

  • On Redis cache, this is handled by the server, automatically.
  • On SQLite cache, purging is executing on every instantiation.
  • On Local File cache, purgin is automatically executed once a day, checked on every instantiation.

Force purging expired data

cache.purge_expired()

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

cache-guiosoft-0.0.4.tar.gz (12.4 kB view hashes)

Uploaded Source

Built Distribution

cache_guiosoft-0.0.4-py3-none-any.whl (19.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page