CacheTimestampsModel.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import '../_version.js';
  2. /**
  3. * Returns the timestamp model.
  4. *
  5. * @private
  6. */
  7. declare class CacheTimestampsModel {
  8. private readonly _cacheName;
  9. private readonly _db;
  10. /**
  11. *
  12. * @param {string} cacheName
  13. *
  14. * @private
  15. */
  16. constructor(cacheName: string);
  17. /**
  18. * Should perform an upgrade of indexedDB.
  19. *
  20. * @param {Event} event
  21. *
  22. * @private
  23. */
  24. private _handleUpgrade;
  25. /**
  26. * @param {string} url
  27. * @param {number} timestamp
  28. *
  29. * @private
  30. */
  31. setTimestamp(url: string, timestamp: number): Promise<void>;
  32. /**
  33. * Returns the timestamp stored for a given URL.
  34. *
  35. * @param {string} url
  36. * @return {number}
  37. *
  38. * @private
  39. */
  40. getTimestamp(url: string): Promise<number>;
  41. /**
  42. * Iterates through all the entries in the object store (from newest to
  43. * oldest) and removes entries once either `maxCount` is reached or the
  44. * entry's timestamp is less than `minTimestamp`.
  45. *
  46. * @param {number} minTimestamp
  47. * @param {number} maxCount
  48. * @return {Array<string>}
  49. *
  50. * @private
  51. */
  52. expireEntries(minTimestamp: number, maxCount?: number): Promise<string[]>;
  53. /**
  54. * Takes a URL and returns an ID that will be unique in the object store.
  55. *
  56. * @param {string} url
  57. * @return {string}
  58. *
  59. * @private
  60. */
  61. private _getId;
  62. }
  63. export { CacheTimestampsModel };