Registry / database / cachy
library0.3.0pypypi✓ verified 88d ago

Cachy provides a simple yet effective caching library for Python. It offers a powerful and thread-safe API with decorator syntax and supports various backend stores including memcached, Redis, database, file system, and in-memory dictionaries. The current stable version is 0.3.0, released in 2019.

pip install cachy
INSTALL
IMPORT
SIG · CACHY
C
cachy
databasepythonv0.3.0
Install
1.5s avg
Import
—
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 1.5s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CacheManager
✓ from cachy import CacheManager
✗ from cachy import Cache
cache_manager
✓ from cachy import cache_manager
Repository
✓ from cachy import Repository

This quickstart demonstrates how to configure and use Cachy with a file-based store. It shows how to put, retrieve, and check for items in the cache. An example for a Redis store is also included (commented out), highlighting the need for external service configuration.

from cachy import Cache import os # Configure a file-based cache store Cache.configure({ 'stores': { 'file': { 'driver': 'file', 'path': os.path.join(os.getcwd(), 'cache_data'), }, 'redis': { 'driver': 'redis', 'host': os.environ.get('REDIS_HOST', 'localhost'), 'password': os.environ.get('REDIS_PASSWORD'), 'port': int(os.environ.get('REDIS_PORT', 6379)), 'database': int(os.environ.get('REDIS_DB', 0)), } }, 'default': 'file', }) # Get the default cache store (file) cache = Cache.store() # Put an item in the cache for 10 minutes (600 seconds) cache.put('my_key', 'my_value', 600) # Retrieve an item from the cache value = cache.get('my_key') print(f"Retrieved value: {value}") # Check if an item exists exists = cache.has('my_key') print(f"Key exists: {exists}") # Get a specific store (e.g., Redis) # Ensure Redis is running and configured correctly via env vars or direct config. # try: # redis_cache = Cache.store('redis') # redis_cache.put('redis_key', 'redis_value', 60) # print(f"Retrieved from Redis: {redis_cache.get('redis_key')}") # except Exception as e: # print(f"Could not connect to Redis: {e}")
Debug
Known issues
breakingCachy explicitly excludes Python versions 3.0 through 3.3. Attempting to use the library with these interpreter versions will result in an error due to the `requires_python` metadata.
fix
Ensure your Python environment is version 2.7+ or 3.4+.
affects: All versions
gotchaThe library's last release was in August 2019 (v0.3.0). This indicates it is not under active development and may not receive updates for newer Python versions, security patches, or compatibility with future library ecosystems.
fix
Evaluate against your project's longevity and maintenance requirements. Consider alternatives if active support or newer Python version compatibility (beyond the declared `requires_python`) is critical.
affects: 0.3.0 and older
gotchaWhen using external cache stores (e.g., Redis, Memcached), Cachy relies on separate client libraries (e.g., `redis`, `python-memcached`). These must be installed manually and configured correctly in Cachy's global configuration. Misconfiguration or missing dependencies will lead to runtime errors or silently failed caching operations.
fix
Install the necessary client libraries for your chosen cache store (`pip install redis` for Redis, `pip install python-memcached` for Memcached) and verify configuration parameters (host, port, credentials) are correct and accessible.
affects: All versions
gotchaCachy uses a global configuration (`Cache.configure`). If your application needs different cache configurations for various parts or threads, managing this global state can become complex and lead to unexpected interactions. Ensure careful handling of configuration updates in multi-threaded or multi-component applications.
fix
Design your application to initialize Cachy's configuration once at startup. If dynamic configuration is needed, consider if Cachy's global approach aligns with your architecture or if a more isolated caching solution is required.
affects: All versions
Upgrade
Version history
0.3.0latest on PyPI · released Aug 6, 2019
Audit
Dependencies
pythonrequiredRequired Python interpreter versions.
redisoptionalOptional, for Redis cache store.
python-memcachedoptionalOptional, for Memcached cache store.
SQLAlchemyoptionalOptional, for database cache store (implicitly needed for 'database' driver).
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
cachy — pip install cachy · libregistry