github-pr-automation
Version:
MCP server and CLI for automated GitHub PR management, review resolution, and workflow optimization
72 lines • 2.18 kB
TypeScript
/**
* In-memory cache with TTL for GitHub API responses
*
* This cache helps reduce API calls and improve performance by storing
* frequently accessed data like PR metadata and check runs.
*/
export interface CacheEntry<T> {
data: T;
timestamp: number;
ttl: number;
}
/**
* In-memory cache implementation with TTL support
*
* Provides efficient caching for GitHub API responses with automatic
* expiration based on configurable TTL values.
*/
export declare class MemoryCache {
private cache;
private readonly maxSize;
/**
* Create a new memory cache instance
* @param maxSize - Maximum number of entries to store (default: 1000)
*/
constructor(maxSize?: number);
/**
* Get cached data if not expired
* @param key - Cache key to retrieve
* @returns Cached data or null if not found/expired
*/
get<T>(key: string): T | null;
/**
* Set cached data with TTL
* @param key - Cache key to store under
* @param data - Data to cache
* @param ttlMs - Time to live in milliseconds
* @returns void
*/
set<T>(key: string, data: T, ttlMs: number): void;
/**
* Delete specific cache entry
* @param key - Cache key to delete
* @returns true if entry was deleted, false if not found
*/
delete(key: string): boolean;
/**
* Clear all cache entries
* @returns void
*/
clear(): void;
/**
* Get cache statistics
* @returns Object containing cache size and max size
*/
getStats(): {
size: number;
maxSize: number;
};
/**
* Clean up expired entries
* @returns Number of entries cleaned up
*/
cleanup(): number;
}
export declare const cache: MemoryCache;
export declare const CacheKeys: {
readonly prMetadata: (owner: string, repo: string, number: number) => string;
readonly checkRuns: (owner: string, repo: string, sha: string) => string;
readonly prComments: (owner: string, repo: string, number: number) => string;
readonly compareCommits: (owner: string, repo: string, base: string, head: string) => string;
};
//# sourceMappingURL=cache.d.ts.map