Skip to main content

Cachetools Utilities

Project description

CacheToolsUtils

Classes to add key prefix and stats to cachetools classes and use redis and memcached as storage backends, and other cache-related utils.

Status Tests Coverage Issues Python Version Badges License

Module Contents

For our purpose, a cache is a key-value store, aka a dictionary, possibly with some constraints on keys (type, size) and values (size, serialization). This module provides new caches, wrappers and other utilities suitable to use with cachetools.

Cache classes

  • RedisCache allows to see a Redis server as a python cache by wrapping a redis.Redis instance.
  • MemCached does the same for a Memcached server. The utility class JsonSerde is a convenient JSON serializer-deserializer class for Memcached.
  • DictCache a very simple dict cache.

Wrappers to extend cache capabilities

  • PrefixedCache, PrefixedMemCached and PrefixedRedisCache add a prefix to distinguish sources on a shared cache.
  • StatsCache, MemCached and RedisCache add a hits method to report the cache hit rate, stats to report statistics and reset to reset statistics.
  • LockedCache use a (thread) lock to control cache accesses.
  • TwoLevelCache allows to combine two caches.
  • DebugCache to trace cache calls using logging.
  • EncryptedCache a cache with key hashing and value encryption.
  • ToBytesCache map keys and values to bytes.
  • BytesCache map bytes keys and values to strings.

Cache utilities

  • cached decorator: a cachetools replacement which allows to test if a function result is in cache, and to delete such an entry.
  • cacheFunctions and cacheMethods: add caching to functions or methods.
  • json_key, hash_json_key, full_hash_key: convenient JSON-based cache key serialization functions for cached.

License

This code is Public Domain.

All software has bug, this is software, hence… Beware that you may lose your hairs or your friends because of it. If you like it, feel free to send a postcard to the author.

More

See the documentation, sources and issues on GitHub.

See packages on PyPI.

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

cachetoolsutils-10.2.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

CacheToolsUtils-10.2-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file cachetoolsutils-10.2.tar.gz.

File metadata

  • Download URL: cachetoolsutils-10.2.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for cachetoolsutils-10.2.tar.gz
Algorithm Hash digest
SHA256 621ea56f625b502e26654aca2cdd5506f2742f05db7270034df5b4674e1f3cef
MD5 41a5b6d58d89d608f701641e7e1f50d1
BLAKE2b-256 ccfd94015bffbf73bd6b793977aee7ee9806129cc8dbedcec261f95aa449758e

See more details on using hashes here.

File details

Details for the file CacheToolsUtils-10.2-py3-none-any.whl.

File metadata

  • Download URL: CacheToolsUtils-10.2-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.3

File hashes

Hashes for CacheToolsUtils-10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1a1ad327aa34f693cc9c21361f62867ef7111f6967c4c6830af2135a7af4bf70
MD5 21a8b6430335588366daf5a81ada7db1
BLAKE2b-256 bb3ba0233f85938d7ed7a2f50bbfa17c97f3656ce5dea8758dbad038977d0ea9

See more details on using hashes here.

Supported by

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