RedisDatabase

Accesses the contents of a Redis database

@safe
struct RedisDatabase {}

Members

Functions

append
long append(string key, T suffix)

Append a value to a key

blpop
Nullable!(Tuple!(string, T)) blpop(string key, long seconds)

BLPOP is a blocking list pop primitive. It is the blocking version of LPOP because it blocks the connection when there are no elements to pop from any of the given lists.

dbSize
long dbSize()

Return the number of keys in the selected database

decr
long decr(string key, long value)

Decrement the integer value of a key by one

del
long del(string[] keys)

Delete a key

deleteAll
void deleteAll()

Deletes all keys of the database.

eval
RedisReply!T eval(string lua_code, string[] keys, ARGS args)

Execute a Lua script server side

evalSHA
RedisReply!T evalSHA(string sha, string[] keys, ARGS args)

Evaluates a script cached on the server side by its SHA1 digest. Scripts are cached on the server side using the scriptLoad function.

exists
bool exists(string key)

Determine if a key exists

expire
bool expire(string key, long seconds)

Set a key's time to live in seconds

expire
bool expire(string key, Duration timeout)

Set a key's time to live with D notation. E.g. 5.minutes for 60 * 5 seconds.

expireAt
bool expireAt(string key, long timestamp)

Set the expiration for a key as a UNIX timestamp

get
T get(string key)

Get the value of a key

getBit
bool getBit(string key, long offset)

Returns the bit value at offset in the string value stored at key

getRange
T getRange(string key, long start, long end)

Get a substring of the string stored at a key

getSet
T getSet(string key, U value)

Set the string value of a key and return its old value

hdel
long hdel(string key, string[] fields)

Delete one or more hash fields

hexists
bool hexists(string key, string field)

Determine if a hash field exists

hget
T hget(string key, string field)

Get the value of a hash field.

hgetAll
RedisReply!T hgetAll(string key)

Get all the fields and values in a hash

hincr
long hincr(string key, string field, long value)

Increment the integer value of a hash field

hincr
long hincr(string key, string field, double value)

Increment the real number value of a hash field

hkeys
RedisReply!T hkeys(string key)

Get all the fields in a hash

hlen
long hlen(string key)

Get the number of fields in a hash

hmget
RedisReply!T hmget(string key, string[] fields)

Get the values of all the given hash fields

hmset
void hmset(string key, ARGS args)

Set multiple hash fields to multiple values

hset
void hset(string key, string field, T value)

Set multiple hash fields to multiple values

hsetNX
bool hsetNX(string key, string field, T value)

Set the value of a hash field, only if the field does not exist

hvals
RedisReply!T hvals(string key)

Get all the values in a hash

incr
long incr(string key, long value)

Increment the integer value of a key

incr
long incr(string key, double value)

Increment the real number value of a key

keys
RedisReply!T keys(string pattern)

Find all keys matching the given glob-style pattern (Supported wildcards: *, ?, ABC)

lindex
T lindex(string key, long index)

Get an element from a list by its index

linsertAfter
long linsertAfter(string key, T1 pivot, T2 value)

Insert value in the list stored at key after the reference value pivot.

linsertBefore
long linsertBefore(string key, T1 pivot, T2 value)

Insert value in the list stored at key before the reference value pivot.

llen
long llen(string key)

Returns the length of the list stored at key. If key does not exist, it is interpreted as an empty list and 0 is returned.

lpop
T lpop(string key)

Removes and returns the first element of the list stored at key.

lpush
long lpush(string key, ARGS args)

Insert all the specified values at the head of the list stored at key.

lpushX
long lpushX(string key, T value)

Inserts value at the head of the list stored at key, only if key already exists and holds a list.

lrange
RedisReply!T lrange(string key, long start, long stop)

Returns the specified elements of the list stored at key.

lrem
long lrem(string key, long count, T value)

Removes the first count occurrences of elements equal to value from the list stored at key.

lset
void lset(string key, long index, T value)

Sets the list element at index to value.

ltrim
void ltrim(string key, long start, long stop)

Trim an existing list so that it will contain only the specified range of elements specified. Equivalent to range = range[start .. stop+1]

mget
RedisReply!T mget(string[] keys)

Get the values of all the given keys

move
bool move(string key, long db)

Move a key to another database

mset
void mset(ARGS args)

Set multiple keys to multiple values

msetNX
bool msetNX(ARGS args)

Set multiple keys to multiple values, only if none of the keys exist

persist
bool persist(string key)

Remove the expiration from a key

pfadd
long pfadd(string key, ARGS args)

Adds one or more Keys to a HyperLogLog data structure .

pfcount
long pfcount(string[] keys)

Returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified key.

pfmerge
void pfmerge(string destkey, ARGS args)

Merge multiple HyperLogLog values into a new one.

pttl
long pttl(string key)

Get the time to live for a key in milliseconds

publish
long publish(string channel, string message)

Publishes a message to all clients subscribed at the channel

pubsub
RedisReply!T pubsub(string subcommand, string[] args)

Inspect the state of the Pub/Sub subsystem

randomKey
string randomKey()

Return a random key from the keyspace

rename
void rename(string key, string newkey)

Rename a key

renameNX
bool renameNX(string key, string newkey)

Rename a key, only if the new key does not exist

request
T request(string command, ARGS args)

Run the specified command and arguments in the Redis database server

rpop
T rpop(string key)

Removes and returns the last element of the list stored at key.

rpoplpush
T rpoplpush(string key, string destination)

Atomically returns and removes the last element (tail) of the list stored at source, and pushes the element at the first element (head) of the list stored at destination.

rpush
long rpush(string key, ARGS args)

Insert all the specified values at the tail of the list stored at key.

rpushX
long rpushX(string key, T value)

Inserts value at the tail of the list stored at key, only if key already exists and holds a list.

sadd
long sadd(string key, ARGS args)

Add the specified members to the set stored at key. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.

scard
long scard(string key)

Returns the set cardinality (number of elements) of the set stored at key.

scriptLoad
string scriptLoad(string lua_code)

Load a script into the scripts cache, without executing it. Run it using evalSHA.

sdiff
RedisReply!T sdiff(string[] keys)

Returns the members of the set resulting from the difference between the first set and all the successive sets.

sdiffStore
long sdiffStore(string destination, string[] keys)

This command is equal to SDIFF, but instead of returning the resulting set, it is stored in destination. If destination already exists, it is overwritten.

set
void set(string key, T value)

Set the string value of a key

setBit
bool setBit(string key, long offset, bool value)

Sets or clears the bit at offset in the string value stored at key

setEX
void setEX(string key, long seconds, T value)

Set the value and expiration of a key

setNX
bool setNX(string key, T value)

Set the value of a key, only if the key does not exist

setNX
bool setNX(string key, T value, Duration expire_time)

Set the value of a key, only if the key does not exist, and also set the specified expire time using D notation, e.g. 5.minutes for 5 minutes.

setRange
long setRange(string key, long offset, T value)

Overwrite part of a string at key starting at the specified offset

setXX
bool setXX(string key, T value)

Set the value of a key, only if the key already exists

setXX
bool setXX(string key, T value, Duration expire_time)

Set the value of a key, only if the key already exists, and also set the specified expire time using D notation, e.g. 5.minutes for 5 minutes.

sinter
RedisReply!T sinter(string[] keys)

Returns the members of the set resulting from the intersection of all the given sets.

sinterStore
long sinterStore(string destination, string[] keys)

This command is equal to SINTER, but instead of returning the resulting set, it is stored in destination. If destination already exists, it is overwritten.

sisMember
bool sisMember(string key, T member)

Returns if member is a member of the set stored at key.

smembers
RedisReply!T smembers(string key)

Returns all the members of the set value stored at key.

smove
bool smove(string source, string destination, T member)

Move member from the set at source to the set at destination. This operation is atomic. In every given moment the element will appear to be a member of source or destination for other clients.

spop
T spop(string key)

Removes and returns a random element from the set value stored at key.

srandMember
T srandMember(string key)

Returns a random element from the set stored at key.

srandMember
RedisReply!T srandMember(string key, long count)

returns count random elements from the set stored at key

srem
long srem(string key, ARGS args)

Remove the specified members from the set stored at key.

strlen
long strlen(string key)

Get the length of the value stored in a key

sunion
RedisReply!T sunion(string[] keys)

Returns the members of the set resulting from the union of all the given sets.

sunionStore
long sunionStore(string[] keys)

This command is equal to SUNION, but instead of returning the resulting set, it is stored in destination.

ttl
long ttl(string key)

Get the time to live for a key

type
string type(string key)

Determine the type stored at key (string, list, set, zset and hash.)

zadd
long zadd(string key, ARGS args)

Add one or more members to a sorted set, or update its score if it already exists

zcard
long zcard(string key)

Returns the sorted set cardinality (number of elements) of the sorted set stored at key.

zcount
long zcount(string key, double min, double max)

Returns the number of elements in the sorted set at key with a score between min and max

zincrby
double zincrby(string key, double value, T member)

Increments the score of member in the sorted set stored at key by increment.

zlexCount
long zlexCount(string key, string min, string max)
Undocumented in source. Be warned that the author may not have intended to support it.
zrange
RedisReply!T zrange(string key, long start, long end, bool with_scores)

Returns the specified range of elements in the sorted set stored at key.

zrangeByLex
RedisReply!T zrangeByLex(string key, string min, string max, long offset, long count)

When all the elements in a sorted set are inserted with the same score, in order to force lexicographical ordering, this command returns all the elements in the sorted set at key with a value between min and max.

zrangeByScore
RedisReply!T zrangeByScore(string key, double start, double end, bool with_scores)

Returns all the elements in the sorted set at key with a score between start and end inclusively

zrangeByScore
RedisReply!T zrangeByScore(string key, double start, double end, long offset, long count, bool with_scores)

Computes an internal list of elements in the sorted set at key with a score between start and end inclusively, and returns a range subselection similar to results[offset .. offset+count]

zrank
long zrank(string key, T member)

Returns the rank of member in the sorted set stored at key, with the scores ordered from low to high.

zrem
long zrem(string key, ARGS members)

Removes the specified members from the sorted set stored at key.

zremRangeByRank
long zremRangeByRank(string key, long start, long stop)

Removes all elements in the sorted set stored at key with rank between start and stop.

zremRangeByScore
long zremRangeByScore(string key, double min, double max)

Removes all elements in the sorted set stored at key with a score between min and max (inclusive).

zrevRange
RedisReply!T zrevRange(string key, long start, long end, bool with_scores)

Returns the specified range of elements in the sorted set stored at key.

zrevRangeByScore
RedisReply!T zrevRangeByScore(string key, double min, double max, bool with_scores)

Returns all the elements in the sorted set at key with a score between max and min (including elements with score equal to max or min).

zrevRangeByScore
RedisReply!T zrevRangeByScore(string key, double min, double max, long offset, long count, bool with_scores)

Computes an internal list of elements in the sorted set at key with a score between max and min, and returns a window of elements selected in a way equivalent to results[offset .. offset + count]

zrevRank
long zrevRank(string key, T member)

Returns the rank of member in the sorted set stored at key, with the scores ordered from high to low.

zscore
RedisReply!T zscore(string key, U member)

Returns the score of member in the sorted set at key.

Properties

client
inout(RedisClient) client [@property getter]

The Redis client with which the database is accessed.

index
long index [@property getter]

Index of the database.

Meta