/
README (full)
CacheLib
A collection of cache libraries in the same API interface. Extracted from Werkzeug.
Supported backends include:
- DynamoDbCache (DynamoDB)
- FileSystemCache (file based)
- MemcachedCache (Memcached)
- MongoDbCache (MongoDB)
- RedisCache (Redis)
- SimpleCache (in-memory, single-process)
- UWSGICache (uWSGI)
- ValkeyCache (Valkey)
Pallets Ecosystem
[!IMPORTANT]
This project is part of the Pallets Ecosystem. Pallets is the open source organization that maintains Flask; Pallets-Eco enables community maintenance of related projects. If you are interested in helping maintain this project, please reach out on the Pallets Discord server.
Installation
Install from PyPI:
pip install cachelib
A Minimal Example
from cachelib import SimpleCache
# Create a cache instance
cache = SimpleCache()
# Set a value in the cache
cache.set("my_key", "my_value")
# Retrieve the value from the cache
value = cache.get("my_key")
print(value) # Output: my_value
# Delete the value from the cache
cache.delete("my_key")
# Try to retrieve the deleted value
value = cache.get("my_key")
print(value) # Output: None
| dir | .github/ |
| dir | debian/ |
| dir | docs/ |
| dir | src/ |
| dir | tests/ |
| file | .editorconfig |
| file | .gitignore |
| file | .pre-commit-config.yaml |
| file | .readthedocs.yaml |
| file | CHANGES.rst |
| file | LICENSE.txt |
| file | README.md |
| file | pyproject.toml |
| file | uv.lock |