Dummy backend that always succeeds but never stores anything. Any values get forgotten immediately,
and operations behave as if the cache always is empty.
classDummyBackend(SyncBackend[WireT],Generic[WireT]):"""Dummy backend that stores nothing."""@classmethoddeffrom_url(cls,url:str)->DummyBackend[WireT]:returnDummyBackend()defget(self,key:str)->WireT:# pragma: no coverraiseKeyError(key)defget_many(self,*keys:str)->Iterable[tuple[str,WireT]]:# pragma: no coverreturn[]defexpire_in(self,key:str,time_to_live:timedelta|None=None)->None:# pragma: no coverreturnNonedefexpire_at(self,key:str,deadline:datetime|None)->None:# pragma: no coverreturnNonedefset(# noqa: A003self,key:str,value:WireT,*,time_to_live:timedelta|None=None,if_not_exists:bool=False,)->bool:# pragma: no coverreturnTruedefset_many(self,items:Iterable[tuple[str,WireT]])->None:# pragma: no coverreturnNonedefdelete(self,key:str)->bool:# pragma: no coverreturnFalse# has never been theredefclear(self)->None:# pragma: no coverreturnNone# already perfectly clean
classDummyBackend(AsyncBackend[WireT],Generic[WireT]):"""Dummy backend that stores nothing."""@classmethoddeffrom_url(cls,url:str)->DummyBackend[WireT]:returnDummyBackend()asyncdefget(self,key:str)->WireT:# pragma: no coverraiseKeyError(key)asyncdefget_many(self,*keys:str)->AsyncIterable[tuple[str,WireT]]:for_in():# pragma: no coveryield()# type: ignoreasyncdefexpire_in(self,key:str,time_to_live:timedelta|None=None)->None:# pragma: no coverreturnNoneasyncdefexpire_at(self,key:str,deadline:datetime|None)->None:# pragma: no coverreturnNoneasyncdefset(# noqa: A003self,key:str,value:WireT,*,time_to_live:timedelta|None=None,if_not_exists:bool=False,)->bool:# pragma: no coverreturnTrueasyncdefset_many(self,items:Iterable[tuple[str,WireT]])->None:# pragma: no coverreturnNoneasyncdefdelete(self,key:str)->bool:# pragma: no coverreturnFalse# has never been thereasyncdefclear(self)->None:# pragma: no coverreturnNone# already perfectly clean