Mgetex
Bun

method

RedisClient.getex

key: KeyLike
): Promise<null | string>;

Get the value of a key and optionally set its expiration

@param key

The key to get

@returns

Promise that resolves with the value of the key, or null if the key doesn't exist

key: KeyLike,
ex: 'EX',
seconds: number
): Promise<null | string>;

Get the value of a key and set its expiration in seconds

@param key

The key to get

@param ex

Set the specified expire time, in seconds

@param seconds

The number of seconds until expiration

@returns

Promise that resolves with the value of the key, or null if the key doesn't exist

key: KeyLike,
px: 'PX',
milliseconds: number
): Promise<null | string>;

Get the value of a key and set its expiration in milliseconds

@param key

The key to get

@param px

Set the specified expire time, in milliseconds

@param milliseconds

The number of milliseconds until expiration

@returns

Promise that resolves with the value of the key, or null if the key doesn't exist

key: KeyLike,
exat: 'EXAT',
timestampSeconds: number
): Promise<null | string>;

Get the value of a key and set its expiration at a specific Unix timestamp in seconds

@param key

The key to get

@param exat

Set the specified Unix time at which the key will expire, in seconds

@param timestampSeconds

The Unix timestamp in seconds

@returns

Promise that resolves with the value of the key, or null if the key doesn't exist

key: KeyLike,
pxat: 'PXAT',
timestampMilliseconds: number
): Promise<null | string>;

Get the value of a key and set its expiration at a specific Unix timestamp in milliseconds

@param key

The key to get

@param pxat

Set the specified Unix time at which the key will expire, in milliseconds

@param timestampMilliseconds

The Unix timestamp in milliseconds

@returns

Promise that resolves with the value of the key, or null if the key doesn't exist

key: KeyLike,
persist: 'PERSIST'
): Promise<null | string>;

Get the value of a key and remove its expiration

@param key

The key to get

@param persist

Remove the expiration from the key

@returns

Promise that resolves with the value of the key, or null if the key doesn't exist

Referenced types

type KeyLike = string | ArrayBufferView | Blob