swimlane.core.cache module¶
Module providing support for automatic APIResource caching
A ResourcesCache instance is provided on all Swimlane client instances automatically
New in version 2.16.2.
-
class
swimlane.core.cache.ResourcesCache(per_cache_max_size)[source]¶ Bases:
objectUniversal APIResource instance cache
Uses separate caches per APIResource type, and provides mapping between available cache keys and real cache primary key automatically
-
swimlane.core.cache.check_cache(resource_type)[source]¶ Decorator for adapter methods to check cache for resource before normally sending requests to retrieve data
Only works with single kwargs, almost always used with @one_of_keyword_only decorator
Parameters: resource_type (type(APIResource)) – Subclass of APIResource of cache to be checked when called
-
swimlane.core.cache.get_cache_index_key(resource)[source]¶ Return a usable cache lookup key for an already initialized resource
Parameters: resource (APIResource|tuple) – APIResource instance or 3-length tuple key returned from this function Raises: TypeError– If resource is not an APIResource instance or acceptable 3-length tuple cache key