SQLModel doesn't natively offer a caching mechanism for session lookups. To cache session.get() results with Redis, you had to write repetitive boilerplate code, hard to maintain and error-prone.
A single __cache_config__ declaration on the model automatically enables caching for all session.get() calls. Per-model configurable TTL, sync and async support, interchangeable Redis transport.
# pip install sqlmodel-cache SQLModelCache.configure( transport=RedisSyncTransport(redis.Redis.from_url("redis://...")), default_ttl=300, ) class Hero(SQLModel, table=True): __cache_config__ = CacheConfig(ttl=600) id: int | None = Field(default=None, primary_key=True) name: str = "" # cache miss → DB, cache hit → Redis hero = session.get(Hero, 1)
Early release v0.1.1 published on PyPI. CI via GitHub Actions with automated tests on every push. Documentation on GitHub Pages. Sync and async support. Temporarily paused. Active development to resume.