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.

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 and hash_json_key: JSON-based cache key serialization functions

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-9.2.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

CacheToolsUtils-9.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cachetoolsutils-9.2.tar.gz
Algorithm Hash digest
SHA256 50ffc586ddc3d56cd40cf47d57892cc0256447ec500a1215727711989b1701d5
MD5 7aef93f3d359e232e8d238293caf907e
BLAKE2b-256 f25f29d0ea18085136ed4c4387195785265e0cfe72ef2f807473f51dff0a5ef9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for CacheToolsUtils-9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 48bb83fc3b582963b6b8ac32df789d54a09835954a5b710cb7ff6327cfb050d5
MD5 60686d53b6e0043794b8d9f5ddc60a25
BLAKE2b-256 556c008b4c41ed03c7cb6dc560fd8558feb4f6250c44db4d1a64f28edfb607f1

See more details on using hashes here.

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