Skip to content

Performance: support batch-operations on caches #10

@Xiphe

Description

@Xiphe

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>;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions