"""Provides a simple dictionary-based backend."""fromdogpile.cache.apiimportCacheBackend,NO_VALUEclassMemoryBackend(CacheBackend):"""A backend that uses a plain dictionary. There is no size management, and values which are placed into the dictionary will remain until explicitly removed. Note that Dogpile's expiration of items is based on timestamps and does not remove them from the cache. E.g.:: from dogpile.cache import make_region region = make_region().configure( 'dogpile.cache.memory' ) To use a Python dictionary of your choosing, it can be passed in with the ``cache_dict`` argument:: my_dictionary = {} region = make_region().configure( 'dogpile.cache.memory', arguments={ "cache_dict":my_dictionary } ) """def__init__(self,arguments):self._cache=arguments.pop("cache_dict",{})defget(self,key):returnself._cache.get(key,NO_VALUE)defset(self,key,value):self._cache[key]=valuedefdelete(self,key):self._cache.pop(key,None)