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.

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.
  • 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.

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

Uploaded Source

Built Distribution

CacheToolsUtils-8.4-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for CacheToolsUtils-8.4.tar.gz
Algorithm Hash digest
SHA256 fb747a534d5f8821ba732867cf1c9bcff23dc4dd24faf25577f1f29ff57b8066
MD5 9750593e55eb8f35777a223900a4b3b0
BLAKE2b-256 51563a0439f0cdb0b5e62d8c7f73c1b444fb63ef4783c389ac6f108bea89f9b5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for CacheToolsUtils-8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1ed7447c080e620f25c127fe993709f682e2defb8cfdbf52252db2f26fdcdb6f
MD5 f94a4d8de2df604f8bd31a8835510376
BLAKE2b-256 9ead60d0530629e6054d449e187ef83c1799586cd1cfa030230517b9f36fe127

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