buildgrid.server.referencestorage.storage module

Reference Cache

Implements an in-memory reference cache.

For a given key, it

class buildgrid.server.referencestorage.storage.ReferenceCache(storage, max_cached_refs, allow_updates=True)

Bases: object

property instance_name
register_instance_with_server(instance_name, server)

Names and registers the refs instance with a given server.

property allow_updates
get_digest_reference(key)

Retrieves the cached Digest for the given key.

Parameters

key – key for Digest to query.

Returns

The cached Digest matching the given key or raises NotFoundError.

get_action_reference(key)

Retrieves the cached ActionResult for the given Action digest.

Parameters

key – key for ActionResult to query.

Returns

The cached ActionResult matching the given key or raises NotFoundError.

update_reference(key, result)

Stores the result in cache for the given key.

If the cache size limit has been reached, the oldest cache entries will be dropped before insertion so that the cache size never exceeds the maximum numbers of entries allowed.

Parameters
  • key – key to store result.

  • result (Digest) – result digest to store.