Amount of data buffered in bytes
class
RedisClient
class RedisClient
- onclose: null | (this: RedisClient, error: Error) => void
Callback fired when the client disconnects from the Redis server
- onconnect: null | (this: RedisClient) => void
Callback fired when the client connects to the Redis server
- ): Promise<number>;
Append a value to a key
@param keyThe key to append to
@param valueThe value to append
@returnsPromise that resolves with the length of the string after the append operation
- ): Promise<number>;
Count the number of set bits (population counting) in a string
@param keyThe key to count bits in
@returnsPromise that resolves with the number of bits set to 1
Disconnect from the Redis server
Connect to the Redis server
@returnsA promise that resolves when connected
- @param key
The key to decrement
@returnsPromise that resolves with the new value
- @param key
The key to delete
@returnsPromise that resolves with the number of keys removed
- @param key
The key to dump
@returnsPromise that resolves with the serialized value, or null if the key doesn't exist
- ): Promise<boolean>;
Determine if a key exists
@param keyThe key to check
@returnsPromise that resolves with true if the key exists, false otherwise
- seconds: number): Promise<number>;
Set a key's time to live in seconds
@param keyThe key to set the expiration for
@param secondsThe number of seconds until expiration
@returnsPromise that resolves with 1 if the timeout was set, 0 if not
- ): Promise<number>;
Get the expiration time of a key as a UNIX timestamp in seconds
@param keyThe key to check
@returnsPromise that resolves with the timestamp, or -1 if the key has no expiration, or -2 if the key doesn't exist
- @param key
The key to get
@returnsPromise that resolves with the key's value, or null if the key doesn't exist
- ): Promise<null | string>;
Get the value of a key and delete the key
@param keyThe key to get and delete
@returnsPromise that resolves with the value of the key, or null if the key doesn't exist
- ): Promise<null | string>;
Get the value of a key and optionally set its expiration
@param keyThe key to get
@returnsPromise that resolves with the value of the key, or null if the key doesn't exist
- ): Promise<null | string>;
Set the value of a key and return its old value
@param keyThe key to set
@param valueThe value to set
@returnsPromise that resolves with the old value, or null if the key didn't exist
- ): Promise<null | Record<string, string>>;
Get all the fields and values in a hash
@param keyThe hash key
@returnsPromise that resolves with an object containing all fields and values
- field: string,increment: string | number): Promise<number>;
Increment the integer value of a hash field by the given number
@param keyThe hash key
@param fieldThe field to increment
@param incrementThe amount to increment by
@returnsPromise that resolves with the new value
- field: string,increment: string | number): Promise<string>;
Increment the float value of a hash field by the given amount
@param keyThe hash key
@param fieldThe field to increment
@param incrementThe amount to increment by
@returnsPromise that resolves with the new value as a string
- ): Promise<string[]>;
Get all field names in a hash
@param keyThe hash key
@returnsPromise that resolves with an array of field names
- @param key
The hash key
@returnsPromise that resolves with the number of fields
- fields: string[]): Promise<null | string[]>;
Get the values of all the given hash fields
@param keyThe hash key
@param fieldsThe fields to get
@returnsPromise that resolves with an array of values
- fieldValues: string[]): Promise<string>;
Set multiple hash fields to multiple values
@param keyThe hash key
@param fieldValuesAn array of alternating field names and values
@returnsPromise that resolves with "OK" on success
- ): Promise<string[]>;
Get all values in a hash
@param keyThe hash key
@returnsPromise that resolves with an array of values
- @param key
The key to increment
@returnsPromise that resolves with the new value
- @param pattern
The pattern to match
@returnsPromise that resolves with an array of matching keys
- @param key
The list key
@returnsPromise that resolves with the length of the list
- @param key
The list key
@returnsPromise that resolves with the first element, or null if the list is empty
- ): Promise<number>;
Prepend one or multiple values to a list
@param keyThe list key
@param valueThe value to prepend
@returnsPromise that resolves with the length of the list after the push operation
- ): Promise<number>;
Prepend a value to a list, only if the list exists
@param keyThe list key
@param valueThe value to prepend
@returnsPromise that resolves with the length of the list after the push operation, or 0 if the list doesn't exist
- @param keys
The keys to get
@returnsPromise that resolves with an array of values, with null for keys that don't exist
- ): Promise<number>;
Remove the expiration from a key
@param keyThe key to persist
@returnsPromise that resolves with 1 if the timeout was removed, 0 if the key doesn't exist or has no timeout
- ): Promise<number>;
Get the expiration time of a key as a UNIX timestamp in milliseconds
@param keyThe key to check
@returnsPromise that resolves with the timestamp, or -1 if the key has no expiration, or -2 if the key doesn't exist
- element: string): Promise<number>;
Add one or more members to a HyperLogLog
@param keyThe HyperLogLog key
@param elementThe element to add
@returnsPromise that resolves with 1 if the HyperLogLog was altered, 0 otherwise
- @param key
The key to check
@returnsPromise that resolves with the TTL in milliseconds, or -1 if the key has no expiration, or -2 if the key doesn't exist
- @param key
The list key
@returnsPromise that resolves with the last element, or null if the list is empty
- ): Promise<number>;
Append one or multiple values to a list
@param keyThe list key
@param valueThe value to append
@returnsPromise that resolves with the length of the list after the push operation
- ): Promise<number>;
Append a value to a list, only if the list exists
@param keyThe list key
@param valueThe value to append
@returnsPromise that resolves with the length of the list after the push operation, or 0 if the list doesn't exist
- @param key
The set key
@param memberThe member to add
@returnsPromise that resolves with 1 if the member was added, 0 if it already existed
- ): Promise<number>;
Get the number of members in a set
@param keyThe set key
@returnsPromise that resolves with the cardinality (number of elements) of the set
- @param command
The command to send
@param argsThe arguments to the command
@returnsA promise that resolves with the command result
- @param key
The key to set
@param valueThe value to set
@returnsPromise that resolves with "OK" on success
@param keyThe key to set
@param valueThe value to set
@param exSet the specified expire time, in seconds
@returnsPromise that resolves with "OK" on success
@param keyThe key to set
@param valueThe value to set
@param pxSet the specified expire time, in milliseconds
@returnsPromise that resolves with "OK" on success
set(exat: 'EXAT',timestampSeconds: number): Promise<'OK'>;Set key to hold the string value with expiration at a specific Unix timestamp
@param keyThe key to set
@param valueThe value to set
@param exatSet the specified Unix time at which the key will expire, in seconds
@returnsPromise that resolves with "OK" on success
set(pxat: 'PXAT',timestampMilliseconds: number): Promise<'OK'>;Set key to hold the string value with expiration at a specific Unix timestamp
@param keyThe key to set
@param valueThe value to set
@param pxatSet the specified Unix time at which the key will expire, in milliseconds
@returnsPromise that resolves with "OK" on success
@param keyThe key to set
@param valueThe value to set
@param nxOnly set the key if it does not already exist
@returnsPromise that resolves with "OK" on success, or null if the key already exists
@param keyThe key to set
@param valueThe value to set
@param xxOnly set the key if it already exists
@returnsPromise that resolves with "OK" on success, or null if the key does not exist
@param keyThe key to set
@param valueThe value to set
@param getReturn the old string stored at key, or null if key did not exist
@returnsPromise that resolves with the old value, or null if key did not exist
@param keyThe key to set
@param valueThe value to set
@param keepttlRetain the time to live associated with the key
@returnsPromise that resolves with "OK" on success
set(...options: string[]): Promise<null | string>;Set key to hold the string value with various options
@param keyThe key to set
@param valueThe value to set
@param optionsArray of options (EX, PX, EXAT, PXAT, NX, XX, KEEPTTL, GET)
@returnsPromise that resolves with "OK" on success, null if NX/XX condition not met, or the old value if GET is specified
- ): Promise<number>;
Set the value of a key, only if the key does not exist
@param keyThe key to set
@param valueThe value to set
@returnsPromise that resolves with 1 if the key was set, 0 if the key was not set
- member: string): Promise<boolean>;
Check if a value is a member of a set
@param keyThe set key
@param memberThe member to check
@returnsPromise that resolves with true if the member exists, false otherwise
- ): Promise<string[]>;
Get all the members in a set
@param keyThe set key
@returnsPromise that resolves with an array of all members
- @param key
The set key
@returnsPromise that resolves with the removed member, or null if the set is empty
- ): Promise<null | string>;
Get a random member from a set
@param keyThe set key
@returnsPromise that resolves with a random member, or null if the set is empty
- @param key
The set key
@param memberThe member to remove
@returnsPromise that resolves with 1 if the member was removed, 0 if it didn't exist
- ): Promise<number>;
Get the length of the value stored in a key
@param keyThe key to check
@returnsPromise that resolves with the length of the string value, or 0 if the key doesn't exist
- @param key
The key to get the TTL for
@returnsPromise that resolves with the TTL, -1 if no expiry, or -2 if key doesn't exist
- ): Promise<number>;
Get the number of members in a sorted set
@param keyThe sorted set key
@returnsPromise that resolves with the cardinality (number of elements) of the sorted set
- ): Promise<null | string>;
Remove and return members with the highest scores in a sorted set
@param keyThe sorted set key
@returnsPromise that resolves with the removed member and its score, or null if the set is empty
- ): Promise<null | string>;
Remove and return members with the lowest scores in a sorted set
@param keyThe sorted set key
@returnsPromise that resolves with the removed member and its score, or null if the set is empty
- ): Promise<null | string>;
Get one or multiple random members from a sorted set
@param keyThe sorted set key
@returnsPromise that resolves with a random member, or null if the set is empty
- member: string): Promise<null | string>;
Get the score associated with the given member in a sorted set
@param keyThe sorted set key
@param memberThe member to get the score for
@returnsPromise that resolves with the score of the member as a string, or null if the member or key doesn't exist