n8n-nodes-smartsuite
Version:
n8n community node for SmartSuite
48 lines (47 loc) • 1.52 kB
TypeScript
/**
* Simple in-memory cache with TTL (Time To Live) support
* Used to cache API responses and reduce redundant calls
*/
type CacheKey = string;
/**
* Get a value from cache if it exists and hasn't expired
* @param key - The cache key
* @param ttlMs - Optional TTL in milliseconds (defaults to 60 seconds)
* @returns The cached value or undefined if not found/expired
*/
export declare function getCache<T>(key: CacheKey, ttlMs?: number): T | undefined;
/**
* Set a value in the cache with timestamp
* @param key - The cache key
* @param value - The value to cache
* @returns The cached value
*/
export declare function setCache<T>(key: CacheKey, value: T): T;
/**
* Clear a specific cache entry
* @param key - The cache key to clear
*/
export declare function clearCache(key: CacheKey): boolean;
/**
* Clear all cache entries
*/
export declare function clearAllCache(): void;
/**
* Get the size of the cache
* @returns Number of entries in the cache
*/
export declare function getCacheSize(): number;
/**
* Clean up expired cache entries
* @param ttlMs - TTL to check against (defaults to 60 seconds)
*/
export declare function cleanupExpiredCache(ttlMs?: number): number;
/**
* Generate a cache key for field options
* @param solutionId - The solution ID
* @param tableId - The table ID
* @param suffix - Optional suffix for the key
* @returns A formatted cache key
*/
export declare function generateFieldsCacheKey(solutionId: string, tableId: string, suffix?: string): string;
export {};