Quickstart
Install
Section titled “Install”uv add lexigram-cacheMinimal Setup — CacheModule
Section titled “Minimal Setup — CacheModule”import asynciofrom lexigram import Applicationfrom lexigram.cache import CacheModule
async def main(): async with Application.boot( name="my-app", modules=[CacheModule.configure()], ) as app: from lexigram.cache import CacheService
cache = await app.container.resolve(CacheService) await cache.set("greeting", "Hello, Lexigram!") value = await cache.get("greeting") print(value) # "Hello, Lexigram!"
asyncio.run(main())Using CacheProvider Directly
Section titled “Using CacheProvider Directly”from lexigram import Applicationfrom lexigram.cache import CacheProvider
def create_app() -> Application: app = Application(name="my-app") app.add_provider(CacheProvider()) return appTesting with CacheModule.stub()
Section titled “Testing with CacheModule.stub()”from lexigram.cache import CacheModule
# In-memory backend with no external connectionstest_module = CacheModule.stub()Next Steps
Section titled “Next Steps”- Guide — caching concepts and workflows
- How-Tos — Redis, Memcached, stampede protection recipes
- Configuration — all configuration keys