loom.core.cache.dependency

Classes

GenerationalDependencyResolver(cache)

Generational tags with monotonic counters in cache backend.

class loom.core.cache.dependency.GenerationalDependencyResolver(cache)[source]

Bases: DependencyResolver

Generational tags with monotonic counters in cache backend.

Parameters:

cache (CacheBackend)

async fingerprint(tags)[source]

Compute a composite fingerprint from generation counters of all tags.

Parameters:

tags (list[str]) – Dependency tag names.

Returns:

A stable hash representing the combined tag generation state.

Return type:

str

async bump_from_events(events)[source]

Increment generation counters for all tags affected by mutation events.

Parameters:

events (tuple[MutationEvent, ...]) – Mutation events to process.

Return type:

None

entity_tags(entity, entity_id)[source]

Return dependency tags for a single entity lookup.

Parameters:
  • entity (str) – Normalized entity name.

  • entity_id (object | None) – Primary key of the entity, or None.

Returns:

List of tag names for this entity.

Return type:

list[str]

list_tags(entity, filter_fingerprint)[source]

Return dependency tags for a list/index query.

Parameters:
  • entity (str) – Normalized entity name.

  • filter_fingerprint (str) – Hash of the applied filter parameters.

Returns:

List of tag names for this list query.

Return type:

list[str]