dogpile.cache backend that uses dictionary for storage
oslo_cache.backends.dictionary.
DictCacheBackend
(arguments)¶Bases: dogpile.cache.api.CacheBackend
A DictCacheBackend based on dictionary.
Arguments accepted in the arguments dictionary:
Parameters: | expiration_time (real) – interval in seconds to indicate maximum time-to-live value for each key in DictCacheBackend. Default expiration_time value is 0, that means that all keys have infinite time-to-live value. |
---|
delete
(key)¶Deletes the value associated with the key if it exists.
Parameters: | key – dictionary key |
---|
delete_multi
(keys)¶Deletes the value associated with each key in list if it exists.
Parameters: | keys – list of dictionary keys |
---|
get
(key)¶Retrieves the value for a key.
Parameters: | key – dictionary key |
---|---|
Returns: | value for a key or oslo_cache.core.NO_VALUE
for nonexistent or expired keys. |
get_multi
(keys)¶Retrieves the value for a list of keys.
set
(key, value)¶Sets the value for a key.
Expunges expired keys during each set.
Parameters: |
|
---|
set_multi
(mapping)¶Set multiple values in the cache. Expunges expired keys during each set.
Parameters: | mapping – dictionary with key/value pairs |
---|
dogpile.cache backend that uses etcd 3.x for storage
oslo_cache.backends.etcd3gw.
Etcd3gwCacheBackend
(arguments)¶Bases: dogpile.cache.api.CacheBackend
DEFAULT_HOST
= 'localhost'¶Default hostname used when none is provided.
DEFAULT_PORT
= 2379¶Default port used if none provided (4001 or 2379 are the common ones).
DEFAULT_TIMEOUT
= 30¶Default socket/lock/member/leader timeout used when none is provided.
delete
(key)¶Delete a value from the cache.
The key will be whatever was passed to the registry, processed by the “key mangling” function, if any.
The behavior here should be idempotent, that is, can be called any number of times regardless of whether or not the key exists.
delete_multi
(keys)¶Delete multiple values from the cache.
The key will be whatever was passed to the registry, processed by the “key mangling” function, if any.
The behavior here should be idempotent, that is, can be called any number of times regardless of whether or not the key exists.
New in version 0.5.0.
get
(key)¶Retrieve a value from the cache.
The returned value should be an instance of
CachedValue
, or NO_VALUE
if
not present.
get_multi
(keys)¶Retrieves the value for a list of keys.
set
(key, value)¶Set a value in the cache.
The key will be whatever was passed
to the registry, processed by the
“key mangling” function, if any.
The value will always be an instance
of CachedValue
.
set_multi
(mapping)¶Set multiple values in the cache.
mapping
is a dict in which
the key will be whatever was passed
to the registry, processed by the
“key mangling” function, if any.
The value will always be an instance
of CachedValue
.
When implementing a new CacheBackend
or cutomizing via
ProxyBackend
, be aware that when this method is invoked by
Region.get_or_create_multi()
, the mapping
values are the
same ones returned to the upstream caller. If the subclass alters the
values in any way, it must not do so ‘in-place’ on the mapping
dict
– that will have the undesirable effect of modifying the returned
values as well.
New in version 0.5.0.
dogpile.cache backend that uses Memcached connection pool
oslo_cache.backends.mongo.
MongoCacheBackend
(arguments)¶Bases: dogpile.cache.api.CacheBackend
A MongoDB based caching backend implementing dogpile backend APIs.
Arguments accepted in the arguments dictionary:
Parameters: |
|
---|
Following are optional parameters for MongoDB backend configuration,
Parameters: |
|
---|
Rest of arguments are passed to mongo calls for read, write and remove. So related options can be specified to pass to these operations.
Further details of various supported arguments can be referred from <http://api.mongodb.org/python/current/api/pymongo/>
client
¶Initializes MongoDB connection and collection defaults.
This initialization is done only once and performed as part of lazy inclusion of MongoDB dependency i.e. add imports only if related backend is used.
Returns: | MongoApi instance |
---|
delete
(key)¶Delete a value from the cache.
The key will be whatever was passed to the registry, processed by the “key mangling” function, if any.
The behavior here should be idempotent, that is, can be called any number of times regardless of whether or not the key exists.
delete_multi
(keys)¶Delete multiple values from the cache.
The key will be whatever was passed to the registry, processed by the “key mangling” function, if any.
The behavior here should be idempotent, that is, can be called any number of times regardless of whether or not the key exists.
New in version 0.5.0.
get
(key)¶Retrieves the value for a key.
Parameters: | key – key to be retrieved. |
---|---|
Returns: | value for a key or oslo_cache.core.NO_VALUE
for nonexistent or expired keys. |
get_multi
(keys)¶Return multiple values from the cache, based on the given keys.
Parameters: | keys – sequence of keys to be retrieved. |
---|---|
Returns: | returns values (or oslo_cache.core.NO_VALUE )
as a list matching the keys given. |
set
(key, value)¶Set a value in the cache.
The key will be whatever was passed
to the registry, processed by the
“key mangling” function, if any.
The value will always be an instance
of CachedValue
.
set_multi
(mapping)¶Set multiple values in the cache.
mapping
is a dict in which
the key will be whatever was passed
to the registry, processed by the
“key mangling” function, if any.
The value will always be an instance
of CachedValue
.
When implementing a new CacheBackend
or cutomizing via
ProxyBackend
, be aware that when this method is invoked by
Region.get_or_create_multi()
, the mapping
values are the
same ones returned to the upstream caller. If the subclass alters the
values in any way, it must not do so ‘in-place’ on the mapping
dict
– that will have the undesirable effect of modifying the returned
values as well.
New in version 0.5.0.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.