Data Layer low complexity shared
0
Dependencies
0
Dependents
1
Entities
0
Integrations

Description

In-memory and optional local-storage cache for the full organizational hierarchy tree. Prevents repeated Supabase fetches for a structure that changes infrequently. Exposes invalidation hooks consumed by the hierarchy service when nodes are created, updated, or deleted.

Feature: Organizational Hierarchy & Structure Management

hierarchy-cache

Responsibilities

  • Cache full hierarchy tree per organization in memory
  • Serve cached tree to hierarchy service on read
  • Invalidate on any write operation to organization_units
  • Persist flat unit list to local storage for offline access

Interfaces

get(organizationId)
set(organizationId, tree)
invalidate(organizationId)
invalidateNode(unitId)
isPersisted(organizationId)

Related Data Entities (1)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/hierarchy-cache 6 endpoints
GET /api/v1/hierarchy-cache List all cached hierarchy entries
GET /api/v1/hierarchy-cache/{organizationId} Get the cached hierarchy tree for an organization
POST /api/v1/hierarchy-cache Populate the cache for an organization's hierarchy tree
PUT /api/v1/hierarchy-cache/{organizationId} Replace/refresh the cached tree for an organization
DELETE /api/v1/hierarchy-cache/{organizationId} Invalidate the full hierarchy cache for an organization
DELETE /api/v1/hierarchy-cache/{organizationId}/nodes/{unitId} Invalidate a single node in the cached hierarchy