Base
BaseCache
Bases: ABC
Abstract base class for cache backends.
Attributes:
Name | Type | Description |
---|---|---|
client |
CacheClient
|
Cache client instance. |
Source code in dynamiq/cache/backends/base.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
__init__(client)
Initialize BaseCache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client |
CacheClient
|
Cache client instance. |
required |
Source code in dynamiq/cache/backends/base.py
16 17 18 19 20 21 22 |
|
delete(key)
abstractmethod
Delete value from cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Cache key. |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
If not implemented. |
Source code in dynamiq/cache/backends/base.py
74 75 76 77 78 79 80 81 82 83 84 |
|
from_client(client)
classmethod
Create cache instance from client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client |
CacheClient
|
Cache client instance. |
required |
Returns:
Name | Type | Description |
---|---|---|
BaseCache |
Cache instance. |
Source code in dynamiq/cache/backends/base.py
24 25 26 27 28 29 30 31 32 33 34 |
|
from_config(config)
abstractmethod
classmethod
Create cache instance from configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
CacheConfig
|
Cache configuration. |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
If not implemented. |
Source code in dynamiq/cache/backends/base.py
36 37 38 39 40 41 42 43 44 45 46 47 |
|
get(key)
abstractmethod
Retrieve value from cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Cache key. |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
If not implemented. |
Source code in dynamiq/cache/backends/base.py
49 50 51 52 53 54 55 56 57 58 59 |
|
set(key, value)
abstractmethod
Set value in cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Cache key. |
required |
value |
dict
|
Value to cache. |
required |
Raises:
Type | Description |
---|---|
NotImplementedError
|
If not implemented. |
Source code in dynamiq/cache/backends/base.py
61 62 63 64 65 66 67 68 69 70 71 72 |
|