Skip to main content

UpstashStore

Upstash Redis-based cache store implementation. Provides a serverless-optimized caching solution ideal for edge and serverless environments.

Remarks

This implementation uses Upstash Redis and is designed for serverless architectures.

Example

import { UpstashClient, UpstashStore } from "@baeta/extension-cache-upstash";

const redis = new UpstashClient({
url: "UPSTASH_REDIS_URL",
token: "UPSTASH_REDIS_TOKEN",
});
const store = new UpstashStore(redis);

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

Extends

Constructors

Constructor

new UpstashStore(client): UpstashStore

Parameters

ParameterType

client

UpstashClient

Returns

UpstashStore

Overrides

Store.constructor

Properties

PropertyModifierType

client

protected

UpstashClient

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