Beaker
A Session and Caching library with WSGI Middleware
What it is and what it does
Beaker is a session and caching library designed for WSGI web applications. It abstracts storage across multiple backends—memory, file, database (via SQLAlchemy), memcached, Redis, and MongoDB—allowing you to choose the right persistence layer for your use case without changing application code. It includes WSGI middleware for transparent session and cache integration, signed cookies to prevent session hijacking, and cookie-only sessions for clustered deployments that don't require a backend store.
The library handles cache namespacing, key expiration, automatic cache regeneration via callbacks, and fine-grained backend toggling per cache object. It has been in production use since 2006 and is integrated into frameworks like Pylons and TurboGears. With zero runtime dependencies and support for Python 3.8–3.13, it is straightforward to install and integrate into existing WSGI applications.
Use it for:
- Store user sessions in memcached or Redis for horizontally scaled web services.
- Cache expensive database queries or API responses with automatic expiration.
- Use signed cookies for stateless session management in clustered environments.
- Implement multi-tier caching (memory + persistent backend) with namespace isolation.
- Integrate session middleware into a Pylons or TurboGears application with minimal configuration.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Beaker provides session management and caching for WSGI web applications, supporting multiple storage backends including memory, file, database, memcached, Redis, and MongoDB.
Yes, with a security caveat. Beaker is production-stable, actively maintained, has zero install friction, and offers a mature, flexible caching and session abstraction for WSGI applications. However, verify whether PYSEC-2020-216 affects version 1.14.1 before deploying to production; if unpatched, assess the risk in your threat model.
Install
beaker on PyPI
pip
pip install beakeruv
uv add beakerpoetry
poetry add beakerInstalling Beaker
Before you install
Low install friction with no runtime dependencies. Actively maintained as of 76 days ago with production-stable status across Python 3.8–3.13.
License in practice
BSD permissive license allows use in most projects without significant restrictions.
Quickstart
pip install beaker
from beaker.cache import CacheManager
from beaker.session import SessionObject
cache_opts = {'cache.type': 'memory'}
cache = CacheManager(**cache_opts)
Requires Python 3.8 or later; optional backends (Redis, memcached, MongoDB) require their respective client libraries.
Verify before relying
- Whether PYSEC-2020-216 affects current version 1.14.1 or has been patched.
- Performance characteristics and scalability limits for high-concurrency scenarios.
- Current maintenance activity level beyond release date (last commit, recent PRs).
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 76 days since the last release |
| First released | |
| Downloads | 269,610/month — #8,256 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | 1 — PYSEC-2020-216 |
Evidence: beaker-1.14.1-py3-none-any.whl
Keywords: wsgi, myghty, session, web, cache, middleware
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
Flask-SessionFlask-Session adds server-side session storage…
permissive · top 5,000 on PyPI
aiohttp-sessionProvides session management for aiohttp.web…
permissive · top 15,000 on PyPI
django-redisProvides a Redis cache and session backend for…
permissive · top 5,000 on PyPI
repoze.whorepoze.who is an identification and…
permissive · top 15,000 on PyPI
django-cache-urlConfigures Django cache backends from…
permissive · top 15,000 on PyPI
requests-cacheAdds persistent HTTP caching to the requests…
permissive · top 5,000 on PyPI
cachelibCacheLib provides a unified API for interacting…
permissive · top 5,000 on PyPI
aiohttp-client-cacheAdds transparent request caching to…
permissive · top 15,000 on PyPI
PastePaste provides WSGI middleware components for…
permissive · top 5,000 on PyPI