selinon.caches.rr module

Random replacement cache implementation.

class selinon.caches.rr.RR(max_cache_size)[source]

Bases: selinon.cache.Cache

Random replacement 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:current cache size
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