Member Junction
    Preparing search index...

    LRU (Least Recently Used) cache implementation for query results with TTL support. This cache provides efficient storage and retrieval of query results with automatic expiration based on time-to-live settings and size limits.

    Supports three caching modes:

    • Full-result cache: stores complete (unpaginated) results via get()/set()
    • Paged cache: stores individual pages via GetPaged()/SetPaged() with page-aware keys
    • Count cache: stores TotalRowCount separately via GetTotalRowCount()/SetTotalRowCount()
    Index

    Constructors

    Methods

    • Clear cache for specific query or all queries.

      Parameters

      • OptionalqueryId: string

        Optional query ID to clear specific query cache

      Returns void

    • Get cache statistics for monitoring and debugging.

      Returns {
          evictions: number;
          expirations: number;
          hitRate: number;
          hits: number;
          misses: number;
          size: number;
      }

      Object containing cache performance metrics

    • Cache query results with TTL and LRU eviction. Evicts least recently used entries when at capacity.

      Parameters

      • queryId: string

        The query identifier

      • params: Record<string, unknown>

        The query parameters

      • results: unknown[]

        The query results to cache

      • config: QueryCacheConfig

        Cache configuration settings

      Returns void

    • Cache results for a specific page of a paged query.

      Parameters

      • queryId: string
      • params: Record<string, unknown>
      • startRow: number
      • maxRows: number
      • results: unknown[]
      • config: QueryCacheConfig

      Returns void

    • Generate a deterministic cache key for an ad-hoc SQL query using FNV-1a hash. Returns a string prefixed with adhoc: followed by the hash.

      Parameters

      • sql: string

      Returns string