Skip to main content

UpstashClient

Extends

  • Redis

Constructors

Constructor

new UpstashClient(options): UpstashClient

Parameters

ParameterType

options

Omit<RedisConfigNodejs, "automaticDeserialization">

Returns

UpstashClient

Overrides

Redis.constructor

Properties

PropertyModifierTypeDescriptionInherited from

addTelemetry

protected

(telemetry) => void

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

Redis.addTelemetry

append

public

(key, value) => Promise<number>

See

https://redis.io/commands/append

Redis.append

autoPipeline

protected

() => Redis

Redis.autoPipeline

bitcount

public

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

See

https://redis.io/commands/bitcount

Redis.bitcount

bitfield

public

(key) => 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, destinationKey, sourceKey, ...sourceKeys): Promise<number>; (op, destinationKey, sourceKey): Promise<number>; }

See

https://redis.io/commands/bitop

Redis.bitop

bitpos

public

(key, bit, start?, end?) => Promise<number>

See

https://redis.io/commands/bitpos

Redis.bitpos

client

protected

Requester

Redis.client

copy

public

(key, destinationKey, opts?) => 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) => Promise<number>

See

https://redis.io/commands/decr

Redis.decr

decrby

public

(key, decrement) => Promise<number>

See

https://redis.io/commands/decrby

Redis.decrby

del

public

(...args) => Promise<number>

See

https://redis.io/commands/del

Redis.del

echo

public

(message) => 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, keys, args) => Promise<TData>

See

https://redis.io/commands/eval

Redis.eval

evalRo

public

<TArgs, TData>(script, keys, args) => Promise<TData>

See

https://redis.io/commands/eval_ro

Redis.evalRo

evalsha

public

<TArgs, TData>(sha1, keys, args) => Promise<TData>

See

https://redis.io/commands/evalsha

Redis.evalsha

evalshaRo

public

<TArgs, TData>(sha1, keys, args) => Promise<TData>

See

https://redis.io/commands/evalsha_ro

Redis.evalshaRo

exec

public

<TResult>(args) => Promise<TResult>

Generic method to execute any Redis command.

Redis.exec

exists

public

(...args) => Promise<number>

See

https://redis.io/commands/exists

Redis.exists

expire

public

(key, seconds, option?) => Promise<0 | 1>

See

https://redis.io/commands/expire

Redis.expire

expireat

public

(key, unix, option?) => Promise<0 | 1>

See

https://redis.io/commands/expireat

Redis.expireat

flushall

public

(args?) => Promise<"OK">

See

https://redis.io/commands/flushall

Redis.flushall

flushdb

public

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

See

https://redis.io/commands/flushdb

Redis.flushdb

geoadd

public

<TData>(args_0, args_1, ...args_2) => Promise<null | number>

See

https://redis.io/commands/geoadd

Redis.geoadd

geodist

public

<TData>(key, member1, member2, unit?) => Promise<null | number>

See

https://redis.io/commands/geodist

Redis.geodist

geohash

public

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

See

https://redis.io/commands/geohash

Redis.geohash

geopos

public

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

See

https://redis.io/commands/geopos

Redis.geopos

geosearch

public

<TData>(key, centerPoint, shape, order, opts?) => Promise<object & object[]>

See

https://redis.io/commands/geosearch

Redis.geosearch

geosearchstore

public

<TData>(destination, key, centerPoint, shape, order, opts?) => Promise<number>

See

https://redis.io/commands/geosearchstore

Redis.geosearchstore

get

public

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

See

https://redis.io/commands/get

Redis.get

getbit

public

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

See

https://redis.io/commands/getbit

Redis.getbit

getdel

public

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

See

https://redis.io/commands/getdel

Redis.getdel

getex

public

<TData>(key, opts?) => Promise<null | TData>

See

https://redis.io/commands/getex

Redis.getex

getrange

public

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

See

https://redis.io/commands/getrange

Redis.getrange

getset

public

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

See

https://redis.io/commands/getset

Redis.getset

hdel

public

(key, ...fields) => Promise<0 | 1>

See

https://redis.io/commands/hdel

Redis.hdel

hexists

public

(key, field) => Promise<number>

See

https://redis.io/commands/hexists

Redis.hexists

hexpire

public

(key, fields, seconds, option?) => Promise<(-2 | 0 | 1 | 2)[]>

See

https://redis.io/commands/hexpire

Redis.hexpire

hexpireat

public

(key, fields, timestamp, option?) => Promise<(-2 | 0 | 1 | 2)[]>

See

https://redis.io/commands/hexpireat

Redis.hexpireat

hexpiretime

public

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

See

https://redis.io/commands/hexpiretime

Redis.hexpiretime

hget

public

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

See

https://redis.io/commands/hget

Redis.hget

hgetall

public

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

See

https://redis.io/commands/hgetall

Redis.hgetall

hincrby

public

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

See

https://redis.io/commands/hincrby

Redis.hincrby

hincrbyfloat

public

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

See

https://redis.io/commands/hincrbyfloat

Redis.hincrbyfloat

hkeys

public

(key) => Promise<string[]>

See

https://redis.io/commands/hkeys

Redis.hkeys

hlen

public

(key) => Promise<number>

See

https://redis.io/commands/hlen

Redis.hlen

hmget

public

<TData>(key, ...fields) => Promise<null | TData>

See

https://redis.io/commands/hmget

Redis.hmget

hmset

public

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

See

https://redis.io/commands/hmset

Redis.hmset

hpersist

public

(key, fields) => Promise<(-2 | -1 | 1)[]>

See

https://redis.io/commands/hpersist

Redis.hpersist

hpexpire

public

(key, fields, milliseconds, option?) => Promise<(-2 | 0 | 1 | 2)[]>

See

https://redis.io/commands/hpexpire

Redis.hpexpire

hpexpireat

public

(key, fields, timestamp, option?) => Promise<(-2 | 0 | 1 | 2)[]>

See

https://redis.io/commands/hpexpireat

Redis.hpexpireat

hpexpiretime

public

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

See

https://redis.io/commands/hpexpiretime

Redis.hpexpiretime

hpttl

public

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

See

https://redis.io/commands/hpttl

Redis.hpttl

hrandfield

public

{(key): Promise<null | string>; (key, count): Promise<string[]>; <TData>(key, count, withValues): Promise<Partial<TData>>; }

See

https://redis.io/commands/hrandfield

Redis.hrandfield

hscan

public

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

See

https://redis.io/commands/hscan

Redis.hscan

hset

public

<TData>(key, kv) => Promise<number>

See

https://redis.io/commands/hset

Redis.hset

hsetnx

public

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

See

https://redis.io/commands/hsetnx

Redis.hsetnx

hstrlen

public

(key, field) => Promise<number>

See

https://redis.io/commands/hstrlen

Redis.hstrlen

httl

public

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

See

https://redis.io/commands/httl

Redis.httl

hvals

public

(key) => Promise<any>

See

https://redis.io/commands/hvals

Redis.hvals

incr

public

(key) => Promise<number>

See

https://redis.io/commands/incr

Redis.incr

incrby

public

(key, value) => Promise<number>

See

https://redis.io/commands/incrby

Redis.incrby

incrbyfloat

public

(key, value) => Promise<number>

See

https://redis.io/commands/incrbyfloat

Redis.incrbyfloat

keys

public

(pattern) => Promise<string[]>

See

https://redis.io/commands/keys

Redis.keys

lindex

public

(key, index) => Promise<any>

See

https://redis.io/commands/lindex

Redis.lindex

linsert

public

<TData>(key, direction, pivot, value) => Promise<number>

See

https://redis.io/commands/linsert

Redis.linsert

llen

public

(key) => Promise<number>

See

https://redis.io/commands/llen

Redis.llen

lmove

public

<TData>(source, destination, whereFrom, whereTo) => Promise<TData>

See

https://redis.io/commands/lmove

Redis.lmove

lmpop

public

<TData>(numkeys, keys, args_2, count?) => Promise<null | [string, TData[]]>

See

https://redis.io/commands/lmpop

Redis.lmpop

lpop

public

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

See

https://redis.io/commands/lpop

Redis.lpop

lpos

public

<TData>(key, element, opts?) => Promise<TData>

See

https://redis.io/commands/lpos

Redis.lpos

lpush

public

<TData>(key, ...elements) => Promise<number>

See

https://redis.io/commands/lpush

Redis.lpush

lpushx

public

<TData>(key, ...elements) => Promise<number>

See

https://redis.io/commands/lpushx

Redis.lpushx

lrange

public

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

See

https://redis.io/commands/lrange

Redis.lrange

lrem

public

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

See

https://redis.io/commands/lrem

Redis.lrem

lset

public

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

See

https://redis.io/commands/lset

Redis.lset

ltrim

public

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

See

https://redis.io/commands/ltrim

Redis.ltrim

mget

public

<TData>(...args) => Promise<TData>

See

https://redis.io/commands/mget

Redis.mget

mset

public

<TData>(kv) => Promise<"OK">

See

https://redis.io/commands/mset

Redis.mset

msetnx

public

<TData>(kv) => 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) => Promise<0 | 1>

See

https://redis.io/commands/persist

Redis.persist

pexpire

public

(key, milliseconds, option?) => Promise<0 | 1>

See

https://redis.io/commands/pexpire

Redis.pexpire

pexpireat

public

(key, unix, option?) => Promise<0 | 1>

See

https://redis.io/commands/pexpireat

Redis.pexpireat

pfadd

public

(args_0, ...args_1) => Promise<number>

See

https://redis.io/commands/pfadd

Redis.pfadd

pfcount

public

(args_0, ...args_1) => Promise<number>

See

https://redis.io/commands/pfcount

Redis.pfcount

pfmerge

public

(destination_key, ...args_1) => Promise<"OK">

See

https://redis.io/commands/pfmerge

Redis.pfmerge

ping

public

(args?) => 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, ttl, value) => Promise<string>

See

https://redis.io/commands/psetex

Redis.psetex

psubscribe

public

<TMessage>(patterns) => Subscriber<TMessage>

See

https://redis.io/commands/psubscribe

Redis.psubscribe

pttl

public

(key) => Promise<number>

See

https://redis.io/commands/pttl

Redis.pttl

publish

public

(channel, message) => 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, destination) => Promise<"OK">

See

https://redis.io/commands/rename

Redis.rename

renamenx

public

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

See

https://redis.io/commands/renamenx

Redis.renamenx

rpop

public

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

See

https://redis.io/commands/rpop

Redis.rpop

rpush

public

<TData>(key, ...elements) => Promise<number>

See

https://redis.io/commands/rpush

Redis.rpush

rpushx

public

<TData>(key, ...elements) => Promise<number>

See

https://redis.io/commands/rpushx

Redis.rpushx

sadd

public

<TData>(key, member, ...members) => Promise<number>

See

https://redis.io/commands/sadd

Redis.sadd

scard

public

(key) => Promise<number>

See

https://redis.io/commands/scard

Redis.scard

scriptExists

public

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

See

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

Redis.scriptExists

scriptFlush

public

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

See

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

Redis.scriptFlush

scriptLoad

public

(script) => Promise<string>

See

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

Redis.scriptLoad

sdiff

public

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

See

https://redis.io/commands/sdiff

Redis.sdiff

sdiffstore

public

(destination, ...keys) => Promise<number>

See

https://redis.io/commands/sdiffstore

Redis.sdiffstore

set

public

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

See

https://redis.io/commands/set

Redis.set

setbit

public

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

See

https://redis.io/commands/setbit

Redis.setbit

setex

public

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

See

https://redis.io/commands/setex

Redis.setex

setnx

public

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

See

https://redis.io/commands/setnx

Redis.setnx

setrange

public

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

See

https://redis.io/commands/setrange

Redis.setrange

sinter

public

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

See

https://redis.io/commands/sinter

Redis.sinter

sinterstore

public

(destination, key, ...keys) => Promise<number>

See

https://redis.io/commands/sinterstore

Redis.sinterstore

sismember

public

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

See

https://redis.io/commands/sismember

Redis.sismember

smembers

public

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

See

https://redis.io/commands/smembers

Redis.smembers

smismember

public

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

See

https://redis.io/commands/smismember

Redis.smismember

smove

public

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

See

https://redis.io/commands/smove

Redis.smove

spop

public

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

See

https://redis.io/commands/spop

Redis.spop

srandmember

public

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

See

https://redis.io/commands/srandmember

Redis.srandmember

srem

public

<TData>(key, ...members) => Promise<number>

See

https://redis.io/commands/srem

Redis.srem

sscan

public

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

See

https://redis.io/commands/sscan

Redis.sscan

strlen

public

(key) => Promise<number>

See

https://redis.io/commands/strlen

Redis.strlen

subscribe

public

<TMessage>(channels) => Subscriber<TMessage>

See

https://redis.io/commands/subscribe

Redis.subscribe

sunion

public

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

See

https://redis.io/commands/sunion

Redis.sunion

sunionstore

public

(destination, key, ...keys) => 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) => Promise<number>

See

https://redis.io/commands/touch

Redis.touch

ttl

public

(key) => Promise<number>

See

https://redis.io/commands/ttl

Redis.ttl

type

public

(key) => Promise<Type>

See

https://redis.io/commands/type

Redis.type

unlink

public

(...args) => Promise<number>

See

https://redis.io/commands/unlink

Redis.unlink

use

public

<TResult>(middleware) => void

Wrap a new middleware around the HTTP client.

Redis.use

xack

public

(key, group, id) => Promise<number>

See

https://redis.io/commands/xack

Redis.xack

xadd

public

(key, id, entries, opts?) => Promise<string>

See

https://redis.io/commands/xadd

Redis.xadd

xautoclaim

public

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

See

https://redis.io/commands/xautoclaim

Redis.xautoclaim

xclaim

public

(key, group, consumer, minIdleTime, id, options?) => Promise<unknown[]>

See

https://redis.io/commands/xclaim

Redis.xclaim

xdel

public

(key, ids) => Promise<number>

See

https://redis.io/commands/xdel

Redis.xdel

xgroup

public

(key, opts) => Promise<never>

See

https://redis.io/commands/xgroup

Redis.xgroup

xinfo

public

(key, options) => Promise<unknown[]>

See

https://redis.io/commands/xinfo

Redis.xinfo

xlen

public

(key) => Promise<number>

See

https://redis.io/commands/xlen

Redis.xlen

xpending

public

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

See

https://redis.io/commands/xpending

Redis.xpending

xrange

public

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

See

https://redis.io/commands/xrange

Redis.xrange

xread

public

(...args) => Promise<unknown[]>

See

https://redis.io/commands/xread

Redis.xread

xreadgroup

public

(...args) => Promise<unknown[]>

See

https://redis.io/commands/xreadgroup

Redis.xreadgroup

xrevrange

public

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

See

https://redis.io/commands/xrevrange

Redis.xrevrange

xtrim

public

(key, options) => Promise<number>

See

https://redis.io/commands/xtrim

Redis.xtrim

zadd

public

<TData>(...args) => Promise<null | number>

See

https://redis.io/commands/zadd

Redis.zadd

zcard

public

(key) => Promise<number>

See

https://redis.io/commands/zcard

Redis.zcard

zcount

public

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

See

https://redis.io/commands/zcount

Redis.zcount

zdiffstore

public

(destination, numkeys, ...keys) => Promise<number>

See

https://redis.io/commands/zdiffstore

Redis.zdiffstore

zincrby

public

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

See

https://redis.io/commands/zincrby

Redis.zincrby

zinterstore

public

(destination, numKeys, keys, opts?) => Promise<number>

See

https://redis.io/commands/zinterstore

Redis.zinterstore

zlexcount

public

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

See

https://redis.io/commands/zlexcount

Redis.zlexcount

zmscore

public

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

See

https://redis.io/commands/zmscore

Redis.zmscore

zpopmax

public

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

See

https://redis.io/commands/zpopmax

Redis.zpopmax

zpopmin

public

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

See

https://redis.io/commands/zpopmin

Redis.zpopmin

zrange

public

<TData>(...args) => Promise<TData>

See

https://redis.io/commands/zrange

Redis.zrange

zrank

public

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

See

https://redis.io/commands/zrank

Redis.zrank

zrem

public

<TData>(key, ...members) => Promise<number>

See

https://redis.io/commands/zrem

Redis.zrem

zremrangebylex

public

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

See

https://redis.io/commands/zremrangebylex

Redis.zremrangebylex

zremrangebyrank

public

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

See

https://redis.io/commands/zremrangebyrank

Redis.zremrangebyrank

zremrangebyscore

public

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

See

https://redis.io/commands/zremrangebyscore

Redis.zremrangebyscore

zrevrank

public

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

See

https://redis.io/commands/zrevrank

Redis.zrevrank

zscan

public

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

See

https://redis.io/commands/zscan

Redis.zscan

zscore

public

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

See

https://redis.io/commands/zscore

Redis.zscore

zunion

public

(numKeys, keys, opts?) => Promise<any>

See

https://redis.io/commands/zunion

Redis.zunion

zunionstore

public

(destination, numKeys, keys, opts?) => 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
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
merge()(key, path, value) => Promise<null | "OK">See https://redis.io/commands/json.merge
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<TResult, TReadonly>(script, opts?): TReadonly extends true ? ScriptRO<TResult> : Script<TResult>

Creates a new script.

Scripts offer the ability to optimistically try to execute a script without having to send the entire script to the server. If the script is loaded on the server, it tries again by sending the entire script. Afterwards, the script is cached on the server.

Type Parameters

Type ParameterDefault type

TResult

unknown

TReadonly extends boolean

false

Parameters

ParameterTypeDescription

script

string

The script to create

opts?

{ readonly?: TReadonly; }

Optional options to pass to the script { readonly?: boolean }

opts.readonly?

TReadonly

Returns

TReadonly extends true ? ScriptRO<TResult> : Script<TResult>

A new script

Examples

const redis = new Redis({...})

const script = redis.createScript<string>("return ARGV[1];")
const arg1 = await script.eval([], ["Hello World"])
expect(arg1, "Hello World")
const redis = new Redis({...})

const script = redis.createScript<string>("return ARGV[1];", { readonly: true })
const arg1 = await script.evalRo([], ["Hello World"])
expect(arg1, "Hello World")

Inherited from

Redis.createScript


scan()

Call Signature

scan(cursor): Promise<ScanResultStandard>

Parameters
ParameterType

cursor

string | number

Returns

Promise<ScanResultStandard>

See

https://redis.io/commands/scan

Inherited from

Redis.scan

Call Signature

scan<TOptions>(cursor, opts): Promise<TOptions extends object ? ScanResultWithType : ScanResultStandard>

Type Parameters
Type Parameter

TOptions extends ScanCommandOptions

Parameters
ParameterType

cursor

string | number

opts

TOptions

Returns

Promise<TOptions extends object ? ScanResultWithType : ScanResultStandard>

See

https://redis.io/commands/scan

Inherited from

Redis.scan


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