Cache
Cache Resource
Filesystem cache operations for storing and retrieving JSON data.
expiration
Get the expiration time for the given number of hours.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hours
|
int
|
The number of hours to add to the current time. |
1
|
Returns:
| Type | Description |
|---|---|
str
|
The expiration time as a string. |
expired
Check if the given expiration time is expired.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exp
|
str
|
The expiration time to check. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if the expiration time is in the past, False otherwise. |
get
Get a cached item from the cache directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key of the item to get. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
The json content parsed as a dict. |
key_for
Get the cache key for the given name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name to get the cache key for. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The cache key as a string. |
set
Set a cached item in the cache directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key of the item to set. |
required |
data
|
dict
|
The data to set. |
required |