kubernetes.informer.cache module

Thread-safe in-memory store for the Kubernetes informer.

class kubernetes.informer.cache.ObjectCache(key_func=None)

Bases: object

Thread-safe in-memory mapping of Kubernetes objects.

The SharedInformer keeps this store synchronised with the API server. Consumers can call list() and get_by_key() from any thread safely.

get(obj)

Look up the cached copy of obj. Returns None when absent.

get_by_key(key)

Look up an object by key. Returns None when absent.

list()

Return a snapshot list of all cached objects.

list_keys()

Return a snapshot list of all cache keys.