Make caches Generic
Ouverte
- Langage dominant
- Python
- Étoiles
- 1.4k
- Forks
- 181
- Métriques de merge des PR
- Aucune PR mergée en 30 j
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]`.
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.