memcached_cache_backend#
- class starlite.cache.memcached_cache_backend.MemcachedCacheBackendConfig#
Bases:
BaseModel
Memcached cache backend configuration.
- class starlite.cache.memcached_cache_backend.MemcachedCacheBackend#
Bases:
CacheBackendProtocol
Memcached-based cache backend.
- __init__(config: MemcachedCacheBackendConfig) None #
Initialize
MemcachedCacheBackend
.- Parameters:
config – required configuration to connect to memcached.
- async get(key: str) Any #
Retrieve a value from cache corresponding to the given key.
- Parameters:
key – name of cached value.
- Returns:
Cached value if existing else
None
.
- async set(key: str, value: Any, expiration: int) None #
Set sa value in cache for a given key for a duration determined by expiration.
- Parameters:
key – key to cache
value
under.value – the value to be cached.
expiration – expiration of cached value in seconds.
Notes
expiration is in seconds.
return value is not used by Starlite internally.
- Returns:
None