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 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). Thi module provide 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 dict cache.

Other wrappers to extend cache capabilities

  • PrefixedCache, PrefixedMemCached and PrefixedRedisCache add a prefix to distinguish sources on a shared cache.
  • StatsCache, StatsMemCached and StatsRedisCache add a hits() method to report the cache hit rate.
  • LockedCache use a (thread) lock to control cache accesses.
  • TwoLevelCache allows to combine two caches.

Cache utilities

  • cached decorator: a cachetools replacement which allows to test e if a function result is in cache, and to delete such an entry.
  • cacheFunctions and cacheMethods: add caching to functions or methods.

More

See the documentation, sources and issues on GitHub.

See packages on PyPI.

License

This code is public domain.

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

Uploaded Source

Built Distribution

CacheToolsUtils-8.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file CacheToolsUtils-8.1.tar.gz.

File metadata

  • Download URL: CacheToolsUtils-8.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for CacheToolsUtils-8.1.tar.gz
Algorithm Hash digest
SHA256 11dce93c0ebf05cd27ee499abfc307901bc1e21e1f34bd41b6de712761b499a6
MD5 7682e641087e95f02848b68fce69c821
BLAKE2b-256 9d3a428a7393e3f60a455d2d6c29c7fcdef8735dd83f96ad6d3abbbcc971ed19

See more details on using hashes here.

File details

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

File metadata

  • Download URL: CacheToolsUtils-8.1-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for CacheToolsUtils-8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13eaed54545d0a63186662cb19d8e51979971134dc0cbe1f84bfb7fbc7874fb2
MD5 606846894125d2d4829424cd15a47edb
BLAKE2b-256 ed83cd220b1d0f66bf486a656b74038aef78d7b79a521fd13eab5e326bd5e0f6

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