Skip to content

Commit

Permalink
Add entries property to SimpleCache type (#45)
Browse files Browse the repository at this point in the history
* Add `entries` property to `SimpleCache` type

* Add changeset
ryangoree authored Mar 1, 2024
1 parent 6d6508d commit affd95f
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-tables-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@delvtech/evm-client": patch
---

Add `entries` property to the `SimpleCache` type.
Original file line number Diff line number Diff line change
@@ -19,6 +19,10 @@ export function createLruSimpleCache<
const cache = new LRUCache(options);

return {
get entries() {
return cache.entries() as Generator<[TKey, TValue]>;
},

get(key) {
return cache.get(stringify(key));
},
5 changes: 5 additions & 0 deletions packages/evm-client/src/cache/types/SimpleCache.ts
Original file line number Diff line number Diff line change
@@ -10,6 +10,11 @@ export interface SimpleCache<
TValue = any,
TKey extends SimpleCacheKey = SimpleCacheKey,
> {
/**
* Returns an iterable of key-value pairs for every entry in the cache.
*/
readonly entries: Iterable<[TKey, TValue]>;

/**
* Retrieves the value associated with the specified key.
*/

0 comments on commit affd95f

Please sign in to comment.