Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance: support batch-operations on caches #10

Open
Xiphe opened this issue Nov 7, 2022 · 0 comments
Open

Performance: support batch-operations on caches #10

Xiphe opened this issue Nov 7, 2022 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Xiphe
Copy link
Collaborator

Xiphe commented Nov 7, 2022

When working with batches, some caches could support batch get/set/delete operations. It would probably save bandwidth / time when cachified would support these operations and fall back to parallel single operations when not supported by the cache.

export interface Cache {
    name?: string;
    get: (key: string) => Eventually<CacheEntry<unknown>>;
    set: (key: string, value: CacheEntry<unknown>) => unknown | Promise<unknown>;
    delete: (key: string) => unknown | Promise<unknown>;
    batch?: {
      get: (keys: string[]) => Eventually<CacheEntry<unknown>[]>;
      set: (entries: { key: string, value: CacheEntry<unknown> }[]) => unknown | Promise<unknown>;
      delete: (keys: string[]) => unknown | Promise<unknown>;
    }
}
@Xiphe Xiphe added the enhancement New feature or request label Nov 7, 2022
@kentcdodds kentcdodds added the help wanted Extra attention is needed label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants