adapter_set¶
-
privex.helpers.cache.adapter_set(adapter: Union[privex.helpers.cache.CacheAdapter.CacheAdapter, str]) → privex.helpers.cache.CacheAdapter.CacheAdapter[source]¶ Set the global cache adapter instance to
adapter- which should be an instantiated adapter class which implementsCacheAdapterExample:
>>> from privex.helpers import cache >>> cache.adapter_set(cache.MemoryCache()) # Passing an instantiated adapter class >>> cache.adapter_set('redis') # Alternatively, you can pass a string alias name of an adapter >>> cache.adapter_set('SqliteCache') # Or the full class name of an adapter
- Parameters
adapter (CacheAdapter) – An instance of a class which implements
CacheAdapterfor global use.- Return CacheAdapter adapter
A reference to your adapter from
__STORE['adapter']