1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import './_version.js';
- interface CacheExpirationConfig {
- maxEntries?: number;
- maxAgeSeconds?: number;
- }
- declare class CacheExpiration {
- private _isRunning;
- private _rerunRequested;
- private readonly _maxEntries?;
- private readonly _maxAgeSeconds?;
- private readonly _cacheName;
- private readonly _timestampModel;
-
- constructor(cacheName: string, config?: CacheExpirationConfig);
- /**
- * Expires entries for the given cache and given criteria.
- */
- expireEntries(): Promise<void>;
- /**
- * Update the timestamp for the given URL. This ensures the when
- * removing entries based on maximum entries, most recently used
- * is accurate or when expiring, the timestamp is up-to-date.
- *
- * @param {string} url
- */
- updateTimestamp(url: string): Promise<void>;
- /**
- * Can be used to check if a URL has expired or not before it's used.
- *
- * This requires a look up from IndexedDB, so can be slow.
- *
- * Note: This method will not remove the cached entry, call
- * `expireEntries()` to remove indexedDB and Cache entries.
- *
- * @param {string} url
- * @return {boolean}
- */
- isURLExpired(url: string): Promise<boolean>;
- /**
- * Removes the IndexedDB object store used to keep track of cache expiration
- * metadata.
- */
- delete(): Promise<void>;
- }
- export { CacheExpiration };
|