Something went wrong. Try again.
A simple Bluesky bot to make sense of the noise, with responses powered by Gemini, similar to Grok.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243interface CacheEntry<T> { value: T; expiry: number;}
class TimedCache<T> { private cache = new Map<string, CacheEntry<T>>(); private ttl: number; // Time to live in milliseconds
constructor(ttl: number) { this.ttl = ttl; }
get(key: string): T | undefined { const entry = this.cache.get(key); if (!entry) { return undefined; }
if (Date.now() > entry.expiry) { this.cache.delete(key); // Entry expired return undefined; }
return entry.value; }
set(key: string, value: T): void { const expiry = Date.now() + this.ttl; this.cache.set(key, { value, expiry }); }
delete(key: string): void { this.cache.delete(key); }
clear(): void { this.cache.clear(); }}
export const postCache = new TimedCache<any>(2 * 60 * 1000); // 2 minutes cache