feat: add getMany() method#99
Conversation
…ance L1/L2 interaction with detailed event emission.
…apters - Introduced `getMany` method in `CacheProvider` interface for batch retrieval of cache values. - Implemented `getMany` in `BentoCache`, `Cache`, `KnexAdapter`, `OrchidAdapter`, and `DynamoDbDriver` to support fetching multiple keys efficiently. - Enhanced error handling and logging in DynamoDB driver for unprocessed keys. - Added comprehensive tests for `getMany` functionality, covering various scenarios including defaults, expired items, and concurrent operations. - Updated typings to ensure correct type inference for `getMany` method across different cache implementations.
🦋 Changeset detectedLatest commit: 846e8cf The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…ny` `defaultValue` handling with new tests.
…econd-level TTLs and adding a delay.
|
Just was looking for a way to get multiple keys from the database, since in my project there are pretty large T1 cache misses. |
|
Hi @Julien-R44, just wanted to check if there are any updates on this PR. Appreciate your time and feedback! |
|
Hey, quick question, was this AI-generated? Just asking because it looks like it might be. |
|
Yes, I did use AI assistance while drafting parts of the code, but I’ve reviewed and understand those sections. I completely understand the need for extra review time, so please take whatever time you need. |
|
Hi @Julien-R44, following up on this PR. It's been a few months since the last update and I wanted to check if you've had a chance to look at it, or if there's something specific blocking it. Happy to make any changes or split it up if needed. |
| * Batch get many items from the remote cache | ||
| */ | ||
| async getMany(keys: string[], options: CacheEntryOptions) { | ||
| return await this.#tryCacheOperation('getMany', options, [], async () => { |
There was a problem hiding this comment.
Please create an enum dont hardcode the string
There was a problem hiding this comment.
Honestly, an enum feels like overkill here. #tryCacheOperation is a private method, and that string is exclusively used to format a single error log. It isn't used for any logic. Creating a dedicated enum just for internal log strings adds boilerplate without giving us any real safety benefits. I'd rather keep it simple and consistent with the rest of the file (see other methods for ref)
closes #78