Debian Codegraph @

docs/examples/stores/registry.py

raw
1 from litestar import Litestar
2 from litestar.stores.memory import MemoryStore
3
4 app = Litestar([], stores={"memory": MemoryStore()})
5
6 memory_store = app.stores.get("memory")
7 # this is the previously defined store
8
9 some_other_store = app.stores.get("something_else")
10 # this will be a newly created instance
11
12 assert app.stores.get("something_else") is some_other_store
13 # but subsequent requests will return the same instance