selinonlib.caches.fifo module¶
First-In-First-Out cache implementation.
-
class
selinonlib.caches.fifo.
FIFO
(max_cache_size)[source]¶ Bases:
selinon.cache.Cache
First-In-First-Out cache.
-
add
(item_id, item, task_name=None, flow_name=None)[source]¶ Add item to cache.
Parameters: - item_id – item id under which item should be referenced
- item – item itself
- task_name – name of task that result should/shouldn’t be cached, unused when caching Celery’s AsyncResult
- flow_name – name of flow in which task was executed, unused when caching Celery’s AsyncResult
-
current_cache_size
¶ Get current cache size.
Returns: length of the current cache
-
get
(item_id, task_name=None, flow_name=None)[source]¶ Get item from cache.
Parameters: - item_id – item id under which the item is stored
- task_name – name of task that result should/shouldn’t be cached, unused when caching Celery’s AsyncResult
- flow_name – name of flow in which task was executed, unused when caching Celery’s AsyncResult
Returns: item itself
-