CacheTimestampsModel.d.ts 1.8 KB

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