@satoshibits/cache-keys
Version:
Type-safe cache key generation with zero dependencies
61 lines • 2.81 kB
text/typescript
import type { ID } from '../types.mjs';
/**
* Analytics-related cache key factories
*/
export declare const analyticsKeys: {
/**
* Real-time analytics data key
* @example analyticsKeys.realtime.key('dashboard123')
* @returns 'analytics:realtime:dashboard123'
*/
readonly realtime: import("../types.mjs").CacheKeyFactory<`analytics:realtime:${string}`, [id: string | number]>;
/**
* Hourly aggregated metrics key
* @example analyticsKeys.hourly.key('metric123', '2024-01-15', 14)
* @returns 'analytics:hourly:metric123:2024-01-15:14'
*/
readonly hourly: import("../types.mjs").CacheKeyFactory<`analytics:hourly:${string}:${string}:${string}`, [metricId: ID, date: string, hour: number]>;
/**
* Daily aggregated metrics key
* @example analyticsKeys.daily.key('metric123', '2024-01-15')
* @returns 'analytics:daily:metric123:2024-01-15'
*/
readonly daily: import("../types.mjs").CacheKeyFactory<`analytics:daily:${string}:${string}`, [metricId: ID, date: string]>;
/**
* Monthly aggregated metrics key
* @example analyticsKeys.monthly.key('metric123', '2024-01')
* @returns 'analytics:monthly:metric123:2024-01'
*/
readonly monthly: import("../types.mjs").CacheKeyFactory<`analytics:monthly:${string}:${string}`, [metricId: ID, yearMonth: string]>;
/**
* Custom report key
* @example analyticsKeys.report.key('report123')
* @returns 'analytics:report:report123'
*/
readonly report: import("../types.mjs").CacheKeyFactory<`analytics:report:${string}`, [id: string | number]>;
/**
* Funnel analysis key
* @example analyticsKeys.funnel.key('funnel123', '2024-01-15')
* @returns 'analytics:funnel:funnel123:2024-01-15'
*/
readonly funnel: import("../types.mjs").CacheKeyFactory<`analytics:funnel:${string}:${string}`, [funnelId: ID, date: string]>;
/**
* Cohort analysis key
* @example analyticsKeys.cohort.key('cohort123', '2024-W03')
* @returns 'analytics:cohort:cohort123:2024-W03'
*/
readonly cohort: import("../types.mjs").CacheKeyFactory<`analytics:cohort:${string}:${string}`, [cohortId: ID, period: string]>;
/**
* Event stream buffer key
* @example analyticsKeys.eventStream.key('stream123')
* @returns 'analytics:eventStream:stream123'
*/
readonly eventStream: import("../types.mjs").CacheKeyFactory<`analytics:eventStream:${string}`, [id: string | number]>;
/**
* Dashboard configuration key
* @example analyticsKeys.dashboard.key('dashboard123')
* @returns 'analytics:dashboard:dashboard123'
*/
readonly dashboard: import("../types.mjs").CacheKeyFactory<`analytics:dashboard:${string}`, [id: string | number]>;
};
//# sourceMappingURL=analytics.d.mts.map