Skip to main content
Version: 1.x

KeyvStore

Keyv-based cache store implementation.

Remarks​

Not recommended for production environments with high query volumes. Consider using Redis or Upstash for production deployments.

Example​

import { KeyvStore } from "@baeta/extension-cache-keyv";
import Keyv from "keyv";

const keyv = new Keyv();
const store = new KeyvStore(keyv);

// Use with cache extension
const cacheExt = cacheExtension(store, {
ttl: 3600,
});

Extends​

Constructors​

Constructor​

new KeyvStore(keyv): KeyvStore

Parameters​

ParameterType

keyv

Keyv

Returns​

KeyvStore

Overrides​

Store.constructor

Properties​

PropertyModifierType

keyv

protected

Keyv

Methods​

createStoreAdapter()​

createStoreAdapter<T>(serializer, options, type, hash): StoreAdapter<T>

Creates a new store adapter for a specific type

Type Parameters​

Type Parameter

T

Parameters​

ParameterTypeDescription

serializer

Serializer

Serializer instance

options

StoreOptions<T>

Store configuration options

type

string

Type name for the cached items

hash

string

Unique hash for the type

Returns​

StoreAdapter<T>

Overrides​

Store.createStoreAdapter