BaseCacheBackend.delete() returns None for 0.3.x compatibility. Atomic one-shot removal is already available through get_and_delete(), but a plain "did anything get deleted?" answer is the better signature and is what callers expect from the underlying stores (Redis DEL returns a count, Memcached delete(noreply=False) returns a bool).
To do
- Change the abstract signature to
async def delete(self, key: str) -> bool.
- Implement it in Memory, Redis and Memcached.
- Update
delete_many's base fallback, which currently counts attempted deletes because delete cannot say whether the key existed.
- Third-party backends that return
None break under type checking; call that out in the changelog.
BaseCacheBackend.delete()returnsNonefor 0.3.x compatibility. Atomic one-shot removal is already available throughget_and_delete(), but a plain "did anything get deleted?" answer is the better signature and is what callers expect from the underlying stores (RedisDELreturns a count, Memcacheddelete(noreply=False)returns a bool).To do
async def delete(self, key: str) -> bool.delete_many's base fallback, which currently counts attempted deletes becausedeletecannot say whether the key existed.Nonebreak under type checking; call that out in the changelog.