selinon.caches.lru module¶
Least-Recently-Used cache implementation.
-
class
selinon.caches.lru.
LRU
(max_cache_size)[source]¶ Bases:
selinon.cache.Cache
Least-Recently-Used 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
-
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
-