Open
Description
We should consider making BaseCache
Generic, so we can provide better type safety when relevant.
Code could then look something like this, with mypy checking:
cache: Cache[str] = Cache(...)
await cache.get("foo") # -> str
await cache.set("foo", "bar") # OK
await cache.set("foo", 45) # Error: Expected str
Existing typing behaviour can be reproduced by annotating it with Cache[Any]
.
Metadata
Metadata
Assignees
Labels
No labels