Skip to main content

@baeta/extension-cache-upstash

Classes

UpstashClient

Extends

  • Redis

Constructors

new UpstashClient()

new UpstashClient(options): UpstashClient

Parameters
ParameterType

options

Omit<RedisConfigNodejs, "automaticDeserialization">

Returns

UpstashClient

Overrides

Redis.constructor

Properties

PropertyModifierTypeDescriptionInherited from

addTelemetry

protected

(telemetry: Telemetry) => void

Technically this is not private, we can hide it from intellisense by doing this

Redis.addTelemetry

append

public

(key: string, value: string) => Promise<number>

See

https://redis.io/commands/append

Redis.append

autoPipeline

protected

() => Redis

Redis.autoPipeline

bitcount

public

(key: string, start: number, end: number) => Promise<number>

See

https://redis.io/commands/bitcount

Redis.bitcount

bitfield

public

(key: string) => BitFieldCommand<Promise<number[]>>

Returns an instance that can be used to execute BITFIELD commands on one key.

Example

redis.set("mykey", 0);
const result = await redis
.bitfield("mykey")
.set("u4", 0, 16)
.incr("u4", "#1", 1)
.exec();
console.log(result); // [0, 1]

See

https://redis.io/commands/bitfield

Redis.bitfield

bitop

public

(op: "and" | "or" | "xor", destinationKey: string, sourceKey: string, ...sourceKeys: string[]) => Promise<number>(op: "not", destinationKey: string, sourceKey: string) => Promise<number>

See

https://redis.io/commands/bitop

Redis.bitop

bitpos

public

(key: string, bit: 0 | 1, start?: number, end?: number) => Promise<number>

See

https://redis.io/commands/bitpos

Redis.bitpos

client

protected

Requester

Redis.client

copy

public

(key: string, destinationKey: string, opts?: object) => Promise<"COPIED" | "NOT_COPIED">

See

https://redis.io/commands/copy

Redis.copy

dbsize

public

() => Promise<number>

See

https://redis.io/commands/dbsize

Redis.dbsize

decr

public

(key: string) => Promise<number>

See

https://redis.io/commands/decr

Redis.decr

decrby

public

(key: string, decrement: number) => Promise<number>

See

https://redis.io/commands/decrby

Redis.decrby

del

public

(...args: string[]) => Promise<number>

See

https://redis.io/commands/del

Redis.del

echo

public

(message: string) => Promise<string>

See

https://redis.io/commands/echo

Redis.echo

enableAutoPipelining

protected

boolean

Redis.enableAutoPipelining

enableTelemetry

protected

boolean

Redis.enableTelemetry

eval

public

<TArgs, TData>(script: string, keys: string[], args: TArgs) => Promise<TData>

See

https://redis.io/commands/eval

Redis.eval

evalsha

public

<TArgs, TData>(sha1: string, keys: string[], args: TArgs) => Promise<TData>

See

https://redis.io/commands/evalsha

Redis.evalsha

exec

public

<TResult>(args: [string, ...args: (string | number | boolean)[]]) => Promise<TResult>

Generic method to execute any Redis command.

Redis.exec

exists

public

(...args: string[]) => Promise<number>

See

https://redis.io/commands/exists

Redis.exists

expire

public

(key: string, seconds: number, option?: "NX" | "nx" | "XX" | "xx" | "GT" | "gt" | "LT" | "lt") => Promise<0 | 1>

See

https://redis.io/commands/expire

Redis.expire

expireat

public

(key: string, unix: number) => Promise<0 | 1>

See

https://redis.io/commands/expireat

Redis.expireat

flushall

public

(args?: [{ async: boolean; }]) => Promise<"OK">

See

https://redis.io/commands/flushall

Redis.flushall

flushdb

public

(opts?: object) => Promise<"OK">

See

https://redis.io/commands/flushdb

Redis.flushdb

geoadd

public

<TData>(args_0: string, args_1: GeoMember<TData> | GeoAddCommandOptions, ...args_2: GeoMember<TData>[]) => Promise<null | number>

See

https://redis.io/commands/geoadd

Redis.geoadd

geodist

public

<TData>(key: string, member1: TData, member2: TData, unit?: "M" | "KM" | "FT" | "MI") => Promise<null | number>

See

https://redis.io/commands/geodist

Redis.geodist

geohash

public

<TData>(args_0: string, ...args_1: TData[]) => Promise<(null | string)[]>

See

https://redis.io/commands/geohash

Redis.geohash

geopos

public

<TData>(args_0: string, ...args_1: TData[]) => Promise<object[]>

See

https://redis.io/commands/geopos

Redis.geopos

geosearch

public

<TData>(key: string, centerPoint: { coordinate: { lat: number; lon: number; }; type: "FROMLONLAT" | "fromlonlat"; } | { member: TData; type: "FROMMEMBER" | "frommember"; }, shape: { radius: number; radiusType: "M" | "KM" | "FT" | "MI"; type: "BYRADIUS" | "byradius"; } | { rect: { height: number; width: number; }; rectType: "M" | "KM" | "FT" | "MI"; type: "BYBOX" | "bybox"; }, order: "ASC" | "DESC" | "asc" | "desc", opts?: object) => Promise<object & object[]>

See

https://redis.io/commands/geosearch

Redis.geosearch

geosearchstore

public

<TData>(destination: string, key: string, centerPoint: { coordinate: { lat: number; lon: number; }; type: "FROMLONLAT" | "fromlonlat"; } | { member: TData; type: "FROMMEMBER" | "frommember"; }, shape: { radius: number; radiusType: "M" | "KM" | "FT" | "MI"; type: "BYRADIUS" | "byradius"; } | { rect: { height: number; width: number; }; rectType: "M" | "KM" | "FT" | "MI"; type: "BYBOX" | "bybox"; }, order: "ASC" | "DESC" | "asc" | "desc", opts?: object) => Promise<number>

See

https://redis.io/commands/geosearchstore

Redis.geosearchstore

get

public

<TData>(key: string) => Promise<null | TData>

See

https://redis.io/commands/get

Redis.get

getbit

public

(key: string, offset: number) => Promise<0 | 1>

See

https://redis.io/commands/getbit

Redis.getbit

getdel

public

<TData>(key: string) => Promise<null | TData>

See

https://redis.io/commands/getdel

Redis.getdel

getex

public

<TData>(key: string, opts?: { ex: number; exat: undefined; persist: undefined; px: undefined; pxat: undefined; } | { px: number; ex: undefined; exat: undefined; persist: undefined; pxat: undefined; } | { exat: number; ex: undefined; persist: undefined; px: undefined; pxat: undefined; } | { pxat: number; ex: undefined; exat: undefined; persist: undefined; px: undefined; } | { persist: true; ex: undefined; exat: undefined; px: undefined; pxat: undefined; } | { ex: undefined; exat: undefined; persist: undefined; px: undefined; pxat: undefined; }) => Promise<null | TData>

See

https://redis.io/commands/getex

Redis.getex

getrange

public

(key: string, start: number, end: number) => Promise<string>

See

https://redis.io/commands/getrange

Redis.getrange

getset

public

<TData>(key: string, value: TData) => Promise<null | TData>

See

https://redis.io/commands/getset

Redis.getset

hdel

public

(key: string, ...fields: string[]) => Promise<0 | 1>

See

https://redis.io/commands/hdel

Redis.hdel

hexists

public

(key: string, field: string) => Promise<number>

See

https://redis.io/commands/hexists

Redis.hexists

hget

public

<TData>(key: string, field: string) => Promise<null | TData>

See

https://redis.io/commands/hget

Redis.hget

hgetall

public

<TData>(key: string) => Promise<null | TData>

See

https://redis.io/commands/hgetall

Redis.hgetall

hincrby

public

(key: string, field: string, increment: number) => Promise<number>

See

https://redis.io/commands/hincrby

Redis.hincrby

hincrbyfloat

public

(key: string, field: string, increment: number) => Promise<number>

See

https://redis.io/commands/hincrbyfloat

Redis.hincrbyfloat

hkeys

public

(key: string) => Promise<string[]>

See

https://redis.io/commands/hkeys

Redis.hkeys

hlen

public

(key: string) => Promise<number>

See

https://redis.io/commands/hlen

Redis.hlen

hmget

public

<TData>(key: string, ...fields: string[]) => Promise<null | TData>

See

https://redis.io/commands/hmget

Redis.hmget

hmset

public

<TData>(key: string, kv: Record<string, TData>) => Promise<"OK">

See

https://redis.io/commands/hmset

Redis.hmset

hrandfield

public

(key: string) => Promise<null | string>(key: string, count: number) => Promise<string[]><TData>(key: string, count: number, withValues: boolean) => Promise<Partial<TData>>

See

https://redis.io/commands/hrandfield

Redis.hrandfield

hscan

public

(key: string, cursor: string | number, cmdOpts?: ScanCommandOptions) => Promise<[string, (string | number)[]]>

See

https://redis.io/commands/hscan

Redis.hscan

hset

public

<TData>(key: string, kv: Record<string, TData>) => Promise<number>

See

https://redis.io/commands/hset

Redis.hset

hsetnx

public

<TData>(key: string, field: string, value: TData) => Promise<0 | 1>

See

https://redis.io/commands/hsetnx

Redis.hsetnx

hstrlen

public

(key: string, field: string) => Promise<number>

See

https://redis.io/commands/hstrlen

Redis.hstrlen

hvals

public

(key: string) => Promise<any>

See

https://redis.io/commands/hvals

Redis.hvals

incr

public

(key: string) => Promise<number>

See

https://redis.io/commands/incr

Redis.incr

incrby

public

(key: string, value: number) => Promise<number>

See

https://redis.io/commands/incrby

Redis.incrby

incrbyfloat

public

(key: string, value: number) => Promise<number>

See

https://redis.io/commands/incrbyfloat

Redis.incrbyfloat

keys

public

(pattern: string) => Promise<string[]>

See

https://redis.io/commands/keys

Redis.keys

lindex

public

(key: string, index: number) => Promise<any>

See

https://redis.io/commands/lindex

Redis.lindex

linsert

public

<TData>(key: string, direction: "before" | "after", pivot: TData, value: TData) => Promise<number>

See

https://redis.io/commands/linsert

Redis.linsert

llen

public

(key: string) => Promise<number>

See

https://redis.io/commands/llen

Redis.llen

lmove

public

<TData>(source: string, destination: string, whereFrom: "left" | "right", whereTo: "left" | "right") => Promise<TData>

See

https://redis.io/commands/lmove

Redis.lmove

lmpop

public

<TData>(numkeys: number, keys: string[], args_2: "LEFT" | "RIGHT", count?: number) => Promise<null | [string, TData[]]>

See

https://redis.io/commands/lmpop

Redis.lmpop

lpop

public

<TData>(key: string, count?: number) => Promise<null | TData>

See

https://redis.io/commands/lpop

Redis.lpop

lpos

public

<TData>(key: string, element: unknown, opts?: object) => Promise<TData>

See

https://redis.io/commands/lpos

Redis.lpos

lpush

public

<TData>(key: string, ...elements: TData[]) => Promise<number>

See

https://redis.io/commands/lpush

Redis.lpush

lpushx

public

<TData>(key: string, ...elements: TData[]) => Promise<number>

See

https://redis.io/commands/lpushx

Redis.lpushx

lrange

public

<TResult>(key: string, start: number, end: number) => Promise<TResult[]>

See

https://redis.io/commands/lrange

Redis.lrange

lrem

public

<TData>(key: string, count: number, value: TData) => Promise<number>

See

https://redis.io/commands/lrem

Redis.lrem

lset

public

<TData>(key: string, index: number, value: TData) => Promise<"OK">

See

https://redis.io/commands/lset

Redis.lset

ltrim

public

(key: string, start: number, end: number) => Promise<"OK">

See

https://redis.io/commands/ltrim

Redis.ltrim

mget

public

<TData>(...args: string[] | [string[]]) => Promise<TData>

See

https://redis.io/commands/mget

Redis.mget

mset

public

<TData>(kv: Record<string, TData>) => Promise<"OK">

See

https://redis.io/commands/mset

Redis.mset

msetnx

public

<TData>(kv: Record<string, TData>) => Promise<number>

See

https://redis.io/commands/msetnx

Redis.msetnx

multi

public

() => Pipeline<[]>

Create a new transaction to allow executing multiple steps atomically.

All the commands in a transaction are serialized and executed sequentially. A request sent by another client will never be served in the middle of the execution of a Redis Transaction. This guarantees that the commands are executed as a single isolated operation.

See

Pipeline

Redis.multi

persist

public

(key: string) => Promise<0 | 1>

See

https://redis.io/commands/persist

Redis.persist

pexpire

public

(key: string, milliseconds: number) => Promise<0 | 1>

See

https://redis.io/commands/pexpire

Redis.pexpire

pexpireat

public

(key: string, unix: number) => Promise<0 | 1>

See

https://redis.io/commands/pexpireat

Redis.pexpireat

pfadd

public

(args_0: string, ...args_1: unknown[]) => Promise<number>

See

https://redis.io/commands/pfadd

Redis.pfadd

pfcount

public

(args_0: string, ...args_1: string[]) => Promise<number>

See

https://redis.io/commands/pfcount

Redis.pfcount

pfmerge

public

(destination_key: string, ...args_1: string[]) => Promise<"OK">

See

https://redis.io/commands/pfmerge

Redis.pfmerge

ping

public

(args?: [string]) => Promise<string>

See

https://redis.io/commands/ping

Redis.ping

pipeline

public

() => Pipeline<[]>

Create a new pipeline that allows you to send requests in bulk.

See

Pipeline

Redis.pipeline

psetex

public

<TData>(key: string, ttl: number, value: TData) => Promise<string>

See

https://redis.io/commands/psetex

Redis.psetex

psubscribe

public

<TMessage>(patterns: string | string[]) => Subscriber<TMessage>

See

https://redis.io/commands/psubscribe

Redis.psubscribe

pttl

public

(key: string) => Promise<number>

See

https://redis.io/commands/pttl

Redis.pttl

publish

public

(channel: string, message: unknown) => Promise<number>

See

https://redis.io/commands/publish

Redis.publish

randomkey

public

() => Promise<null | string>

See

https://redis.io/commands/randomkey

Redis.randomkey

rename

public

(source: string, destination: string) => Promise<"OK">

See

https://redis.io/commands/rename

Redis.rename

renamenx

public

(source: string, destination: string) => Promise<0 | 1>

See

https://redis.io/commands/renamenx

Redis.renamenx

rpop

public

<TData>(key: string, count?: number) => Promise<null | TData>

See

https://redis.io/commands/rpop

Redis.rpop

rpush

public

<TData>(key: string, ...elements: TData[]) => Promise<number>

See

https://redis.io/commands/rpush

Redis.rpush

rpushx

public

<TData>(key: string, ...elements: TData[]) => Promise<number>

See

https://redis.io/commands/rpushx

Redis.rpushx

sadd

public

<TData>(key: string, member: TData, ...members: TData[]) => Promise<number>

See

https://redis.io/commands/sadd

Redis.sadd

scan

public

(cursor: string | number, opts?: ScanCommandOptions) => Promise<[string, string[]]>

See

https://redis.io/commands/scan

Redis.scan

scard

public

(key: string) => Promise<number>

See

https://redis.io/commands/scard

Redis.scard

scriptExists

public

(...args: string[]) => Promise<number[]>

See

https://redis.io/commands/script-exists

Redis.scriptExists

scriptFlush

public

(opts?: ScriptFlushCommandOptions) => Promise<"OK">

See

https://redis.io/commands/script-flush

Redis.scriptFlush

scriptLoad

public

(script: string) => Promise<string>

See

https://redis.io/commands/script-load

Redis.scriptLoad

sdiff

public

(key: string, ...keys: string[]) => Promise<unknown[]>

See

https://redis.io/commands/sdiff

Redis.sdiff

sdiffstore

public

(destination: string, ...keys: string[]) => Promise<number>

See

https://redis.io/commands/sdiffstore

Redis.sdiffstore

set

public

<TData>(key: string, value: TData, opts?: SetCommandOptions) => Promise<null | "OK" | TData>

See

https://redis.io/commands/set

Redis.set

setbit

public

(key: string, offset: number, value: 0 | 1) => Promise<0 | 1>

See

https://redis.io/commands/setbit

Redis.setbit

setex

public

<TData>(key: string, ttl: number, value: TData) => Promise<"OK">

See

https://redis.io/commands/setex

Redis.setex

setnx

public

<TData>(key: string, value: TData) => Promise<number>

See

https://redis.io/commands/setnx

Redis.setnx

setrange

public

(key: string, offset: number, value: string) => Promise<number>

See

https://redis.io/commands/setrange

Redis.setrange

sinter

public

(key: string, ...keys: string[]) => Promise<string[]>

See

https://redis.io/commands/sinter

Redis.sinter

sinterstore

public

(destination: string, key: string, ...keys: string[]) => Promise<number>

See

https://redis.io/commands/sinterstore

Redis.sinterstore

sismember

public

<TData>(key: string, member: TData) => Promise<0 | 1>

See

https://redis.io/commands/sismember

Redis.sismember

smembers

public

<TData>(key: string) => Promise<TData>

See

https://redis.io/commands/smembers

Redis.smembers

smismember

public

<TMembers>(key: string, members: TMembers) => Promise<(0 | 1)[]>

See

https://redis.io/commands/smismember

Redis.smismember

smove

public

<TData>(source: string, destination: string, member: TData) => Promise<0 | 1>

See

https://redis.io/commands/smove

Redis.smove

spop

public

<TData>(key: string, count?: number) => Promise<null | TData>

See

https://redis.io/commands/spop

Redis.spop

srandmember

public

<TData>(key: string, count?: number) => Promise<null | TData>

See

https://redis.io/commands/srandmember

Redis.srandmember

srem

public

<TData>(key: string, ...members: TData[]) => Promise<number>

See

https://redis.io/commands/srem

Redis.srem

sscan

public

(key: string, cursor: string | number, opts?: ScanCommandOptions) => Promise<[string, (string | number)[]]>

See

https://redis.io/commands/sscan

Redis.sscan

strlen

public

(key: string) => Promise<number>

See

https://redis.io/commands/strlen

Redis.strlen

subscribe

public

<TMessage>(channels: string | string[]) => Subscriber<TMessage>

See

https://redis.io/commands/subscribe

Redis.subscribe

sunion

public

(key: string, ...keys: string[]) => Promise<unknown[]>

See

https://redis.io/commands/sunion

Redis.sunion

sunionstore

public

(destination: string, key: string, ...keys: string[]) => Promise<number>

See

https://redis.io/commands/sunionstore

Redis.sunionstore

time

public

() => Promise<[number, number]>

See

https://redis.io/commands/time

Redis.time

touch

public

(...args: string[]) => Promise<number>

See

https://redis.io/commands/touch

Redis.touch

ttl

public

(key: string) => Promise<number>

See

https://redis.io/commands/ttl

Redis.ttl

type

public

(key: string) => Promise<Type>

See

https://redis.io/commands/type

Redis.type

unlink

public

(...args: string[]) => Promise<number>

See

https://redis.io/commands/unlink

Redis.unlink

use

public

<TResult>(middleware: (r, next) => Promise<UpstashResponse<TResult>>) => void

Wrap a new middleware around the HTTP client.

Redis.use

xack

public

(key: string, group: string, id: string | string[]) => Promise<number>

See

https://redis.io/commands/xack

Redis.xack

xadd

public

(key: string, id: string, entries: Record<string, unknown>, opts?: object) => Promise<string>

See

https://redis.io/commands/xadd

Redis.xadd

xautoclaim

public

(key: string, group: string, consumer: string, minIdleTime: number, start: string, options?: object) => Promise<unknown[]>

See

https://redis.io/commands/xautoclaim

Redis.xautoclaim

xclaim

public

(key: string, group: string, consumer: string, minIdleTime: number, id: string | string[], options?: object) => Promise<unknown[]>

See

https://redis.io/commands/xclaim

Redis.xclaim

xdel

public

(key: string, ids: string | string[]) => Promise<number>

See

https://redis.io/commands/xdel

Redis.xdel

xgroup

public

(key: string, opts: { group: string; id: string; type: "CREATE"; options: { ENTRIESREAD: number; MKSTREAM: boolean; }; } | { consumer: string; group: string; type: "CREATECONSUMER"; } | { consumer: string; group: string; type: "DELCONSUMER"; } | { group: string; type: "DESTROY"; } | { group: string; id: string; type: "SETID"; options: { ENTRIESREAD: number; }; }) => Promise<never>

See

https://redis.io/commands/xgroup

Redis.xgroup

xinfo

public

(key: string, options: { group: string; type: "CONSUMERS"; } | { type: "GROUPS"; }) => Promise<unknown[]>

See

https://redis.io/commands/xinfo

Redis.xinfo

xlen

public

(key: string) => Promise<number>

See

https://redis.io/commands/xlen

Redis.xlen

xpending

public

(key: string, group: string, start: string, end: string, count: number, options?: object) => Promise<unknown[]>

See

https://redis.io/commands/xpending

Redis.xpending

xrange

public

(key: string, start: string, end: string, count?: number) => Promise<Record<string, Record<string, unknown>>>

See

https://redis.io/commands/xrange

Redis.xrange

xread

public

(...args: [string, string, object] | [string[], string[], object]) => Promise<unknown[]>

See

https://redis.io/commands/xread

Redis.xread

xreadgroup

public

(...args: [string, string, string, string, Options] | [string, string, string[], string[], Options]) => Promise<unknown[]>

See

https://redis.io/commands/xreadgroup

Redis.xreadgroup

xrevrange

public

(key: string, end: string, start: string, count?: number) => Promise<Record<string, Record<string, unknown>>>

See

https://redis.io/commands/xrevrange

Redis.xrevrange

xtrim

public

(key: string, options: object) => Promise<number>

See

https://redis.io/commands/xtrim

Redis.xtrim

zadd

public

<TData>(...args: [string, ScoreMember<TData>, ...scoreMemberPairs: ScoreMember<TData>[]] | [string, ZAddCommandOptions, ScoreMember<TData>, ...ScoreMember<TData>[]]) => Promise<null | number>

See

https://redis.io/commands/zadd

Redis.zadd

zcard

public

(key: string) => Promise<number>

See

https://redis.io/commands/zcard

Redis.zcard

zcount

public

(key: string, min: string | number, max: string | number) => Promise<number>

See

https://redis.io/commands/zcount

Redis.zcount

zdiffstore

public

(destination: string, numkeys: number, ...keys: string[]) => Promise<number>

See

https://redis.io/commands/zdiffstore

Redis.zdiffstore

zincrby

public

<TData>(key: string, increment: number, member: TData) => Promise<number>

See

https://redis.io/commands/zincrby

Redis.zincrby

zinterstore

public

(destination: string, numKeys: number, keys: string[], opts?: ZInterStoreCommandOptions) => Promise<number>

See

https://redis.io/commands/zinterstore

Redis.zinterstore

zlexcount

public

(key: string, min: string, max: string) => Promise<number>

See

https://redis.io/commands/zlexcount

Redis.zlexcount

zmscore

public

(key: string, members: unknown[]) => Promise<null | number[]>

See

https://redis.io/commands/zmscore

Redis.zmscore

zpopmax

public

<TData>(key: string, count?: number) => Promise<TData[]>

See

https://redis.io/commands/zpopmax

Redis.zpopmax

zpopmin

public

<TData>(key: string, count?: number) => Promise<TData[]>

See

https://redis.io/commands/zpopmin

Redis.zpopmin

zrange

public

<TData>(...args: [string, number, number, ZRangeCommandOptions] | [string, "-" | "+" | `(${string}` | `[${string}`, "-" | "+" | `(${string}` | `[${string}`, object & ZRangeCommandOptions] | [string, number | `(${number}` | "-inf" | "+inf", number | `(${number}` | "-inf" | "+inf", object & ZRangeCommandOptions]) => Promise<TData>

See

https://redis.io/commands/zrange

Redis.zrange

zrank

public

<TData>(key: string, member: TData) => Promise<null | number>

See

https://redis.io/commands/zrank

Redis.zrank

zrem

public

<TData>(key: string, ...members: TData[]) => Promise<number>

See

https://redis.io/commands/zrem

Redis.zrem

zremrangebylex

public

(key: string, min: string, max: string) => Promise<number>

See

https://redis.io/commands/zremrangebylex

Redis.zremrangebylex

zremrangebyrank

public

(key: string, start: number, stop: number) => Promise<number>

See

https://redis.io/commands/zremrangebyrank

Redis.zremrangebyrank

zremrangebyscore

public

(key: string, min: number, max: number) => Promise<number>

See

https://redis.io/commands/zremrangebyscore

Redis.zremrangebyscore

zrevrank

public

<TData>(key: string, member: TData) => Promise<null | number>

See

https://redis.io/commands/zrevrank

Redis.zrevrank

zscan

public

(key: string, cursor: string | number, opts?: ScanCommandOptions) => Promise<[string, (string | number)[]]>

See

https://redis.io/commands/zscan

Redis.zscan

zscore

public

<TData>(key: string, member: TData) => Promise<null | number>

See

https://redis.io/commands/zscore

Redis.zscore

zunion

public

(numKeys: number, keys: string[], opts?: ZUnionCommandOptions) => Promise<any>

See

https://redis.io/commands/zunion

Redis.zunion

zunionstore

public

(destination: string, numKeys: number, keys: string[], opts?: ZUnionStoreCommandOptions) => Promise<number>

See

https://redis.io/commands/zunionstore

Redis.zunionstore

opts?

protected

CommandOptions<any, any>

Redis.opts

Accessors

json
Get Signature

get json(): object

Returns

object

NameTypeDescription
arrappend(key, path, ...values) => Promise<(null | number)[]>See https://redis.io/commands/json.arrappend
arrindex(key, path, value, start?, stop?) => Promise<(null | number)[]>See https://redis.io/commands/json.arrindex
arrinsert(key, path, index, ...values) => Promise<(null | number)[]>See https://redis.io/commands/json.arrinsert
arrlen(key, path?) => Promise<(null | number)[]>See https://redis.io/commands/json.arrlen
arrpop(key, path?, index?) => Promise<unknown[]>See https://redis.io/commands/json.arrpop
arrtrim(key, path?, start?, stop?) => Promise<(null | number)[]>See https://redis.io/commands/json.arrtrim
clear(key, path?) => Promise<number>See https://redis.io/commands/json.clear
del(key, path?) => Promise<number>See https://redis.io/commands/json.del
forget(key, path?) => Promise<number>See https://redis.io/commands/json.forget
get<TData>(...args) => Promise<null | TData>See https://redis.io/commands/json.get
mget<TData>(keys, path) => Promise<TData>See https://redis.io/commands/json.mget
mset(...args) => Promise<null | "OK">See https://redis.io/commands/json.mset
numincrby(key, path, value) => Promise<(null | number)[]>See https://redis.io/commands/json.numincrby
nummultby(key, path, value) => Promise<(null | number)[]>See https://redis.io/commands/json.nummultby
objkeys(key, path?) => Promise<(null | string[])[]>See https://redis.io/commands/json.objkeys
objlen(key, path?) => Promise<(null | number)[]>See https://redis.io/commands/json.objlen
resp(key, path?) => Promise<any>See https://redis.io/commands/json.resp
set(key, path, value, opts?) => Promise<null | "OK">See https://redis.io/commands/json.set
strappend(key, path, value) => Promise<(null | number)[]>See https://redis.io/commands/json.strappend
strlen(key, path?) => Promise<(null | number)[]>See https://redis.io/commands/json.strlen
toggle(key, path) => Promise<number[]>See https://redis.io/commands/json.toggle
type(key, path?) => Promise<string[]>See https://redis.io/commands/json.type
Inherited from

Redis.json

readYourWritesSyncToken
Get Signature

get readYourWritesSyncToken(): undefined | string

Returns

undefined | string

Set Signature

set readYourWritesSyncToken(session): void

Parameters
ParameterType

session

undefined | string

Returns

void

Inherited from

Redis.readYourWritesSyncToken

Methods

createScript()

createScript(script): Script

Parameters
ParameterType

script

string

Returns

Script

Inherited from

Redis.createScript

fromEnv()

static fromEnv(config?): Redis

Create a new Upstash Redis instance from environment variables.

Use this to automatically load connection secrets from your environment variables. For instance when using the Vercel integration.

This tries to load UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN from your environment using process.env.

Parameters
ParameterType

config?

Omit<RedisConfigNodejs, "url" | "token">

Returns

Redis

Inherited from

Redis.fromEnv


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

  • Store

Constructors

new UpstashStore()

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