AsyncMemoryCache¶
-
class
privex.helpers.cache.asyncx.AsyncMemoryCache.
AsyncMemoryCache
(*args, **kwargs)[source]¶ A very basic cache adapter which implements
AsyncCacheAdapter
- stores the cache in memory using the static attribute__CACHE
As the cache is simply stored in memory, any python object can be cached without needing any form of serialization.
Fully supports cache expiration.
Basic Usage:
>>> from time import sleep >>> c = AsyncMemoryCache() >>> await c.set('test:example', 'hello world', timeout=60) >>> await c.get('test:example') 'hello world' >>> sleep(60) >>> await c.get('test:example', 'NOT FOUND') 'NOT FOUND'
-
__init__
(*args, **kwargs) Initialize self. See help(type(self)) for accurate signature.
-
Methods¶
Methods
|
Return the value of cache key |
|
Remove one or more keys from the cache. |
|
Set the cache key |
|
Update the timeout for a given |