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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for CacheToolsUtils-8.0.tar.gz
Algorithm Hash digest
SHA256 d9675d60e4a0c736b8edfdec075554cd39a12c97e4aa514bb70b63b6e8c38a8d
MD5 9c9c235eb570abad9c2d1a19116e5ffd
BLAKE2b-256 a7c24064ba2669e08017e03b7d92a7ba02d2d902d0944fc8b77646226d029ddc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: CacheToolsUtils-8.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e714204968fd7227780c8b5f12ea78ec5e65714886436a8d41a58f67dfaa8c47
MD5 7188640ec6deabbb2111c8120ebce40b
BLAKE2b-256 dbf3164e2fac4fd6810edced903a1ad30304ff0da29d66114b62e6054da77204

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