buildgrid.server.actioncache.caches.with_cache module

class buildgrid.server.actioncache.caches.with_cache.WithCacheActionCache(cache: ActionCacheABC, fallback: ActionCacheABC, allow_updates: bool, cache_failed_actions: bool)

Bases: ActionCacheABC

An ActionCache that first makes use of a storage and fallback cache

start() None

A method called when the grpc service is starting.

This method may be overriden if startup logic is required.

stop() None

A method called when the grpc service is shutting down.

This method may be overriden if shutdown logic is required.

get_action_result(action_digest: Digest) ActionResult

Retrieves the cached result for an Action.

Will first attempt to retrieve result from cache and then fallback. A NotFoundError is raised if both cache and fallback return None.

Parameters:

action_digest (Digest) – The digest of the Action to retrieve the cached result of.

update_action_result(action_digest: Digest, action_result: ActionResult) None

Stores a result for an Action in the cache.

Will attempt to store result in cache, and then in fallback cache. If the result has a non-zero exit code and cache_failed_actions is False for this cache, the result is not cached.

Parameters:
  • action_digest (Digest) – The digest of the Action whose result is being cached.

  • action_result (ActionResult) – The result to cache for the given Action digest.