vibe.db.redis.types

Convenience wrappers types for accessing Redis keys.

Note that the API is still subject to change!

Types 7

The type of a Redis key.

noneNon-existent key
stringString/binary value
listLinked list
setUnsorted set
zsetSorted set
hashUnsorted map

Represents a generic Redis value.

Fields
string m_key
Methods
inout(RedisDatabase) database() @property inoutThe database in which the key is stored.
string key() @property constName of the corresponding key.
Duration ttl() @propertyRemaining time-to-live.
RedisType type() @propertyThe data type of the referenced value.
bool exists() @propertyChecks if the referenced key exists.
bool remove()Removes the referenced key.
bool expire(Duration expire_time)Sets the key for expiration after the given timeout.
bool expireAt(SysTime expire_time)Sets the key for expiration at the given point in time.
bool persist()Removes any existing expiration time for the key.
bool moveTo(long dst_database)Moves this key to a different database.
void rename(string new_name)Renames the referenced key.
bool renameIfNotExist(string new_name)Renames the referenced key if the destination key doesn't exist.
Constructors
this(RedisDatabase db, string key)
structRedisString(T = string)

Represents a Redis string value.

In addition to the methods specific to string values, all operations of

RedisValue are available using an alias this declaration.
Fields
Methods
long length() @propertyThe length in bytes of the string.
T get()
T getSet(T value)
bool getBit(long offset)
bool setBit(long offset, bool value)
void setExpire(T value, Duration expire_time)
bool setIfNotExist(T value)
string getSubString(long start, long end)
long setSubString(long offset, string value)
void opAssign(T value)
long opOpAssign(string OP)(string value) if (OP == "~")
long opUnary(string OP)() if (OP == "++")
long opUnary(string OP)() if (OP == "--")
long opOpAssign(string OP)(long value) if (OP == "+")
long opOpAssign(string OP)(long value) if (OP == "-")
long opOpAssign(string OP)(double value) if (OP == "+")
long opOpAssign(string OP)(double value) if (OP == "-")
Constructors
this(RedisDatabase db, string key)
structRedisHash(T = string)

Represents a Redis hash value.

In addition to the methods specific to hash values, all operations of

RedisValue are available using an alias this declaration.
Fields
Methods
bool remove()
size_t remove(scope string[] fields...)
bool exists(string field)
bool exists()
void opIndexAssign(T value, string field)
T opIndex(string field)
T get(string field, T def_value)
bool setIfNotExist(string field, T value)
void opIndexOpAssign(string op)(T value, string field) if (op == "+")
void opIndexOpAssign(string op)(T value, string field) if (op == "-")
int opApply(scope int delegate(string key, T value) @safe del)
int opApply(scope int delegate(string key) @safe del)
long length()
void getMultiple(T[] dst, scope string[] fields...)
Constructors
this(RedisDatabase db, string key)
structRedisList(T = string)

Represents a Redis list value.

In addition to the methods specific to list values, all operations of

RedisValue are available using an alias this declaration.
Fields
Methods
Dollar opDollar()
T opIndex(long index)
T opIndex(Dollar index)
void opIndexAssign(T value, long index)
void opIndexAssign(T value, Dollar index)
auto opSlice(S, E)(S start, E end) if ((is(S : long) || is(S == Dollar)) && (is(E : long) || is(E == Dollar)))
auto opSlice()()
long length()
long insertBefore(T pivot, T value)
long insertAfter(T pivot, T value)
long insertFront(T value)
long insertFrontIfExists(T value)
long insertBack(T value)
long insertBackIfExists(T value)
long removeAll(T value)
long removeFirst(T value, long count = 1)
long removeLast(T value, long count = 1)
void trim(long start, long end)
Nullable!T removeFrontBlock(Duration max_wait = 0.seconds)
int opApply(scope int delegate(T) @safe del)
Constructors
this(RedisDatabase db, string key)
Nested Templates
Dollar
structRedisSet(T = string)

Represents a Redis set value.

In addition to the methods specific to set values, all operations of

RedisValue are available using an alias this declaration.
Fields
Methods
long insert(ARGS...)(ARGS args)
long remove(T value)
bool remove()
string pop()
long length()
string getRandom()
bool contains(T value)
int opApply(scope int delegate(T value) @safe del)
bool intersects(scope RedisSet[] sets...)
auto getAll()
Constructors
this(RedisDatabase db, string key)
structRedisZSet(T = string)

Represents a Redis sorted set value.

In addition to the methods specific to sorted set values, all operations of

RedisValue are available using an alias this declaration.
Fields
Methods
long insert(ARGS...)(ARGS args)
long remove(ARGS...)(ARGS members)
bool remove()
long length()
long count(string INT = "[]")(double min, double max) if (INT == "[]")
long removeRangeByRank(long start, long end)
long removeRangeByScore(string INT = "[]")(double min, double max) if (INT == "[]")
double opIndexOpAssign(string op)(double value, string member) if (op == "+")
long getRank(string member)
long getReverseRank(string member)
long countByLex(string min, string max)
auto rangeByLex(T = string)(string min = "-", string max = "+", long offset = 0, long count = - 1)
Constructors
this(RedisDatabase db, string key)

Functions 8

fnRedisString!T getAsString(T = string)(RedisDatabase db, string key)Returns a handle to a string type value.
fnRedisSet!T getAsSet(T = string)(RedisDatabase db, string key)Returns a handle to a set type value.
fnRedisZSet!T getAsZSet(T = string)(RedisDatabase db, string key)Returns a handle to a set type value.
fnRedisHash!T getAsHash(T = string)(RedisDatabase db, string key)Returns a handle to a hash type value.
fnRedisList!T getAsList(T = string)(RedisDatabase db, string key)Returns a handle to a list type value.
fnstring toRedis(T)(T value)Converts the given value to a binary/string representation suitable for Redis storage.
fnvoid toRedis(R, T)(ref R dst, T value)ditto
fnT fromRedis(T)(string value)Converts a Redis value back to its original representation.