docs/examples/stores/get_set.py
raw| 1 | from litestar.stores.memory import MemoryStore |
| 2 | |
| 3 | store = MemoryStore() |
| 4 | |
| 5 | |
| 6 | async def main() -> None: |
| 7 | value = await store.get("key") |
| 8 | print(value) # this will print 'None', as no store with this key has been defined yet |
| 9 | |
| 10 | await store.set("key", b"value") |
| 11 | value = await store.get("key") |
| 12 | print(value) |