--- id: cachelib version: "0.15.4" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # cachelib — A collection of cache libraries in the same API interface. License: permissive · Maintenance: active · Downloads: 19.3M/mo ## What it is and what it does CacheLib is a cache abstraction library that presents a single, consistent API for seven different cache backends. Instead of writing code tied to Redis or Memcached directly, you instantiate a cache object (RedisCache, MemcachedCache, SimpleCache, etc.) and use the same get/set/delete methods regardless of the backend. It was extracted from Werkzeug and is maintained by the Pallets Ecosystem. The library supports both local caching (SimpleCache for single-process in-memory, FileSystemCache for disk) and distributed backends (Redis, Memcached, MongoDB, DynamoDB, Valkey, uWSGI). This makes it useful for applications that need to switch cache strategies without refactoring—for example, using SimpleCache in development and RedisCache in production. Use it for: - Swap cache backends in a Flask or web application without changing application logic. - Implement a local development cache (SimpleCache) that scales to Redis in production. - Cache expensive database queries or API responses using a consistent interface. - Store session data or temporary state across multiple processes using a shared backend. - Reduce coupling between application code and a specific caching technology. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. CacheLib provides a unified API for interacting with multiple cache backends—Redis, Memcached, MongoDB, DynamoDB, file system, in-memory, uWSGI, and Valkey—so you can swap implementations without changing application code. Yes. CacheLib is actively maintained, has no security vulnerabilities, zero runtime dependencies, and low install friction. It solves a real problem—cache backend abstraction—and is part of the trusted Pallets Ecosystem. Install it if you need flexible caching or plan to support multiple backends. ## Install pip install cachelib uv add cachelib poetry add cachelib ## Installing cachelib Before you install: Low friction: pure Python wheel with no runtime dependencies. Actively maintained—last commit 2026-08-12, released 2026-08-08, part of the Pallets Ecosystem. License in practice: BSD-3-Clause (permissive): you may use, modify, and distribute this package freely in commercial and private projects, provided you include the license notice. Quickstart: pip install cachelib from cachelib import SimpleCache cache = SimpleCache() cache.set("key", "value") print(cache.get("key")) # Output: value Python 3.11 or later required. Backend-specific clients (redis, pymongo, etc.) must be installed separately if using non-local backends. Verify before relying: - Whether backend clients (redis, pymongo, etc.) are optional or required for specific cache types to function. - Performance characteristics and memory overhead of SimpleCache vs. external backends under load. - Whether type hints cover all public methods and backend-specific parameters. ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 19.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags cache abstraction layer, multi-backend caching, redis memcached wrapper, unified cache interface, cache backend abstraction, distributed cache client, in-memory cache library, cache-abstraction, multi-backend, pallets-ecosystem [View on SkillFed](https://skillfed.io/packages/cachelib) · [View on PyPI](https://pypi.org/project/cachelib/)