nostr-deploy-server
Version:
Node.js server for hosting static websites under npub subdomains using Nostr protocol and Blossom servers
73 lines • 2.08 kB
TypeScript
import 'websocket-polyfill';
/**
* Real-time Cache Invalidation Service
*
* Subscribes to Nostr relays and invalidates cache entries when relevant events are received.
* Follows distributed systems best practices for cache invalidation as outlined in:
* - https://amankrpandey1.medium.com/mastering-cache-invalidation-implementation-and-best-practices-47c70f66d3ad
* - https://blog.the-pans.com/when-and-how-to-invalidate-cache/
*/
export declare class CacheInvalidationService {
private pool;
private config;
private connections;
private subscriptions;
private reconnectTimers;
private isEnabled;
private isShuttingDown;
constructor();
/**
* Initialize invalidation service and start subscriptions
*/
private initialize;
/**
* Connect to invalidation relays
*/
private connectToRelays;
/**
* Start subscriptions for cache invalidation events
*/
private startInvalidationSubscriptions;
/**
* Subscribe to static file mapping events (kind 34128)
*/
private subscribeToStaticFileEvents;
/**
* Subscribe to relay list events (kind 10002)
*/
private subscribeToRelayListEvents;
/**
* Subscribe to blossom server list events (kind 10063)
*/
private subscribeToBlossomServerEvents;
/**
* Handle static file mapping events for cache invalidation
*/
private handleStaticFileEvent;
/**
* Handle relay list events for cache update
*/
private handleRelayListEvent;
/**
* Handle blossom server list events for cache update
*/
private handleBlossomServerEvent;
/**
* Schedule reconnection to failed relays
*/
private scheduleReconnect;
/**
* Get service statistics
*/
getStats(): {
enabled: boolean;
connectedRelays: number;
activeSubscriptions: number;
relays: string[];
};
/**
* Gracefully shutdown the invalidation service
*/
shutdown(): Promise<void>;
}
//# sourceMappingURL=cache-invalidation.d.ts.map