/**
 * Shared cache types and interfaces
 * 
 * These types provide consistency across all domain-specific cache services.
 */

/**
 * Cache bucket metrics for hit/miss tracking
 */
export interface CacheBucketMetrics {
  hits: number;
  misses: number;
}

/**
 * Cache dependencies for tracking relationships between cached data
 * Used for granular invalidation (e.g., invalidate all catalog entries that depend on Product X)
 */
export interface CacheDependencies {
  productIds?: string[];
  accountIds?: string[];
  [key: string]: string[] | undefined;
}

/**
 * Options for cache operations
 */
export interface CacheOptions<T> {
  /**
   * Whether to cache null values
   * @default false
   */
  allowNull?: boolean;

  /**
   * TTL in seconds (null = no expiry, CDC-driven invalidation only)
   * @default null
   */
  ttl?: number | null;

  /**
   * Callback to resolve cache dependencies for granular invalidation
   */
  resolveDependencies?: (value: T) => CacheDependencies | Promise<CacheDependencies | undefined> | undefined;
}

