cacheable 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -212,6 +212,7 @@ By default we use lazy expiration deletion which means on `get` and `getMany` ty
212
212
  * `clear()`: Clears the cache.
213
213
  * `size()`: The number of keys in the cache.
214
214
  * `keys()`: The keys in the cache.
215
+ * `items()`: The items in the cache as `{ key, value, expiration }`.
215
216
  * `checkExpired()`: Checks for expired keys in the cache. This is used by the `checkInterval` property.
216
217
  * `startIntervalCheck()`: Starts the interval check for expired keys if `checkInterval` is above 0 ms.
217
218
  * `stopIntervalCheck()`: Stops the interval check for expired keys.
package/dist/index.cjs CHANGED
@@ -174,6 +174,9 @@ var CacheableMemory = class {
174
174
  get keys() {
175
175
  return this.concatStores().keys();
176
176
  }
177
+ get items() {
178
+ return this.concatStores().values();
179
+ }
177
180
  get(key) {
178
181
  const store = this.getStore(key);
179
182
  const item = store.get(key);
package/dist/index.d.cts CHANGED
@@ -52,6 +52,11 @@ type CacheableMemoryOptions = {
52
52
  lruSize?: number;
53
53
  checkInterval?: number;
54
54
  };
55
+ type CacheableItem$1 = {
56
+ key: string;
57
+ value: any;
58
+ expires?: number;
59
+ };
55
60
  declare class CacheableMemory {
56
61
  private readonly _hashCache;
57
62
  private readonly _hash0;
@@ -81,6 +86,7 @@ declare class CacheableMemory {
81
86
  set checkInterval(value: number);
82
87
  get size(): number;
83
88
  get keys(): IterableIterator<string>;
89
+ get items(): IterableIterator<CacheableItem$1>;
84
90
  get<T>(key: string): any;
85
91
  set(key: string, value: any, ttl?: number): void;
86
92
  has(key: string): boolean;
package/dist/index.d.ts CHANGED
@@ -52,6 +52,11 @@ type CacheableMemoryOptions = {
52
52
  lruSize?: number;
53
53
  checkInterval?: number;
54
54
  };
55
+ type CacheableItem$1 = {
56
+ key: string;
57
+ value: any;
58
+ expires?: number;
59
+ };
55
60
  declare class CacheableMemory {
56
61
  private readonly _hashCache;
57
62
  private readonly _hash0;
@@ -81,6 +86,7 @@ declare class CacheableMemory {
81
86
  set checkInterval(value: number);
82
87
  get size(): number;
83
88
  get keys(): IterableIterator<string>;
89
+ get items(): IterableIterator<CacheableItem$1>;
84
90
  get<T>(key: string): any;
85
91
  set(key: string, value: any, ttl?: number): void;
86
92
  has(key: string): boolean;
package/dist/index.js CHANGED
@@ -145,6 +145,9 @@ var CacheableMemory = class {
145
145
  get keys() {
146
146
  return this.concatStores().keys();
147
147
  }
148
+ get items() {
149
+ return this.concatStores().values();
150
+ }
148
151
  get(key) {
149
152
  const store = this.getStore(key);
150
153
  const item = store.get(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cacheable",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Simple Caching Engine using Keyv",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",