[][src]Struct redisclient::client::RedisClient

pub struct RedisClient { /* fields omitted */ }

Implementations

impl RedisClient[src]

pub fn new() -> RedisResult<RedisClient>[src]

pub fn with_config(config: RedisConfig) -> RedisResult<RedisClient>[src]

pub fn flushall(&mut self) -> RedisResult<()>[src]

pub fn auth<S>(&mut self, username: Option<S>, password: S) -> RedisResult<()> where
    S: ToString
[src]

The AUTH command authenticates the current connection

Return value: Simple string reply

pub fn echo<S>(&mut self, message: S) -> RedisResult<String> where
    S: ToString
[src]

Returns message.

Return value: Bulk string reply

pub fn ping(&mut self) -> RedisResult<()>[src]

Returns PONG if no argument is provided, otherwise return a copy of the argument as a bulk.

Return value: Simple string reply

pub fn quit(&mut self) -> RedisResult<()>[src]

Ask the server to close the connection.

Return value: Simple string reply

pub fn select(&mut self, index: u8) -> RedisResult<()>[src]

Select the Redis logical database having the specified zero-based numeric index.

Return value: Simple string reply

pub fn hdel<K>(&mut self, key: K, fields: Vec<K>) -> RedisResult<usize> where
    K: RedisSerializationProtocol
[src]

Removes the specified fields from the hash stored at key.

Return value: Integer reply

pub fn hexists<K, F>(&mut self, key: K, field: F) -> RedisResult<bool> where
    K: RedisSerializationProtocol,
    F: RedisSerializationProtocol
[src]

Returns if field is an existing field in the hash stored at key.

Return value: Integer reply

pub fn hget<K, F, V>(&mut self, key: K, field: F) -> RedisResult<V> where
    K: RedisSerializationProtocol,
    F: RedisSerializationProtocol,
    V: RedisDeserializationProtocol
[src]

Returns the value associated with field in the hash stored at key.

Return value: Bulk string reply

pub fn hgetall<K, M>(&mut self, key: K) -> RedisResult<M> where
    K: RedisSerializationProtocol,
    M: RedisDeserializationProtocol
[src]

Returns all fields and values of the hash stored at key.

Return value: Array reply

pub fn hincrby<K, F>(
    &mut self,
    key: K,
    field: F,
    increment: i64
) -> RedisResult<i64> where
    K: RedisSerializationProtocol,
    F: RedisSerializationProtocol
[src]

Increments the number stored at field in the hash stored at key by increment.

Return value: Integer value

pub fn hincrbyfloat<K, F>(
    &mut self,
    key: K,
    field: F,
    increment: f64
) -> RedisResult<f64> where
    K: RedisSerializationProtocol,
    F: RedisSerializationProtocol
[src]

Increment the specified field of a hash stored at key, and representing a floating point number, by the specified increment.

Return value: Bulk string reply

pub fn hkeys<K, V>(&mut self, key: K) -> RedisResult<Vec<V>> where
    K: RedisSerializationProtocol,
    V: RedisDeserializationProtocol
[src]

Returns all field names in the hash stored at key.

Return value: Array reply

pub fn hlen<K>(&mut self, key: K) -> RedisResult<u64> where
    K: RedisSerializationProtocol
[src]

Returns the number of fields contained in the hash stored at key.

Return value: Integer reply

pub fn hmget<K, F, V>(&mut self, key: K, fields: Vec<F>) -> RedisResult<Vec<V>> where
    K: RedisSerializationProtocol,
    F: RedisSerializationProtocol,
    V: RedisDeserializationProtocol
[src]

Returns the values associated with the specified fields in the hash stored at key.

Return value: Array reply

pub fn hmset<K, F, V>(&mut self, key: K, fvs: Vec<(F, V)>) -> RedisResult<()> where
    K: RedisSerializationProtocol,
    F: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Sets the specified fields to their respective values in the hash stored at key.

Return values: Simple string reply

pub fn hscan(&mut self)[src]

pub fn hset<K, F, V>(
    &mut self,
    key: K,
    field: F,
    value: V
) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    F: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Sets field in the hash stored at key to value.

Return value: Integer reply

pub fn hsetnx<K, F, V>(
    &mut self,
    key: K,
    field: F,
    value: V
) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    F: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Sets field in the hash stored at key to value, only if field does not yet exist.

Return value: Integer value

pub fn hstrlen<K, F>(&mut self, key: K, field: F) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    F: RedisSerializationProtocol
[src]

Returns the string length of the value associated with field in the hash stored at key.

Return value: Integer reply

pub fn hvals<K, V>(&mut self, key: K) -> RedisResult<Vec<V>> where
    K: RedisSerializationProtocol,
    V: RedisDeserializationProtocol
[src]

Returns all values in the hash stored at key.

Return value: Array reply

pub fn copy(&mut self) -> RedisResult<()>[src]

This command copies the value stored at the source key to the destination key.

Return value: Integer reply

pub fn del<K>(&mut self, keys: Vec<K>) -> RedisResult<usize> where
    K: RedisSerializationProtocol
[src]

Removes the specified keys. A key is ignored if it does not exist.

Return value: Integer reply

pub fn dump<K>(&mut self, key: K) -> RedisResult<String> where
    K: RedisSerializationProtocol
[src]

Serialize the value stored at key in a Redis-specific format and return it to the user.

Return value: Bulk string reply

pub fn exists<K>(&mut self, keys: Vec<K>) -> RedisResult<usize> where
    K: RedisSerializationProtocol
[src]

Returns if key exists.

Return value: Integer reply

pub fn expire<K>(&mut self, key: K, seconds: usize) -> RedisResult<bool> where
    K: RedisSerializationProtocol
[src]

Set a timeout on key. After the timeout has expired, the key will automatically be deleted.

Return value: Integer reply

pub fn expireat<K>(&mut self, key: K, timestamp: u64) -> RedisResult<bool> where
    K: RedisSerializationProtocol
[src]

EXPIREAT has the same effect and semantic as EXPIRE, but instead of specifying the number of seconds representing the TTL, it takes an absolute Unix timestamp.

Return value: Integer reply

pub fn keys<S>(&mut self, pattern: S) -> RedisResult<Vec<String>> where
    S: ToString
[src]

Returns all keys matching pattern.

Return value: Array reply

pub fn persist<K>(&mut self, key: K) -> RedisResult<bool> where
    K: RedisSerializationProtocol
[src]

Remove the existing timeout on key, turning the key from volatile to persistent.

Return value: Integer reply

pub fn pexpire<K>(&mut self, key: K, milliseconds: u64) -> RedisResult<bool> where
    K: RedisSerializationProtocol
[src]

This command works exactly like EXPIRE but the time to live of the key is specified in milliseconds instead of seconds.

Return value: Integer reply

pub fn pttl<K>(&mut self, key: K) -> RedisResult<i64> where
    K: RedisSerializationProtocol
[src]

Like TTL this command returns the remaining time to live of a key that has an expire set, with the sole difference that TTL returns the amount of remaining time in seconds while PTTL returns it in milliseconds.

Return value: Integer reply

pub fn randomkey(&mut self) -> RedisResult<String>[src]

Return a random key from the currently selected database.

Return value: Bulk string reply

pub fn rename<K>(&mut self, key: K, newkey: K) -> RedisResult<()> where
    K: RedisSerializationProtocol
[src]

Renames key to newkey. It returns an error when key does not exist.

Return value: Simple string reply

pub fn renamenx<K>(&mut self, key: K, newkey: K) -> RedisResult<bool> where
    K: RedisSerializationProtocol
[src]

Renames key to newkey if newkey does not yet exist. It returns an error when key does not exist.

Return value: Integer reply

pub fn touch<K>(&mut self, keys: Vec<K>) -> RedisResult<isize> where
    K: RedisSerializationProtocol
[src]

Alters the last access time of a key(s). A key is ignored if it does not exist.

Return value: Integer reply

pub fn ttl<K>(&mut self, key: K) -> RedisResult<isize> where
    K: RedisSerializationProtocol
[src]

Returns the remaining time to live of a key that has a timeout.

Return value: Integer reply

pub fn type_<K>(&mut self, key: K) -> RedisResult<DataType> where
    K: RedisSerializationProtocol
[src]

Returns the string representation of the type of the value stored at key.

Return value: Simple string reply

This command is very similar to DEL: it removes the specified keys.

Return value: Integer reply

pub fn brpoplpush<K, E>(
    &mut self,
    source: K,
    destination: K,
    timeout: usize
) -> RedisResult<E> where
    K: RedisSerializationProtocol,
    E: RedisDeserializationProtocol
[src]

BRPOPLPUSH is the blocking variant of RPOPLPUSH.

Return value: Bulk string reply

pub fn lindex<K, V>(&mut self, key: K, index: isize) -> RedisResult<V> where
    K: RedisSerializationProtocol,
    V: RedisDeserializationProtocol
[src]

Returns the element at index index in the list stored at key.

Return value: Bulk string reply

pub fn linsert<K, E>(
    &mut self,
    key: K,
    operator: ListBeforeOrAfter,
    pivot: E,
    element: E
) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    E: RedisSerializationProtocol
[src]

Inserts element in the list stored at key either before or after the reference value pivot.

Return value: Integer reply

pub fn llen<K>(&mut self, key: K) -> RedisResult<usize> where
    K: RedisSerializationProtocol
[src]

Returns the length of the list stored at key.

Return value: Integer reply

pub fn lpop<K, E>(&mut self, key: K) -> RedisResult<E> where
    K: RedisSerializationProtocol,
    E: RedisDeserializationProtocol
[src]

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

Return value: Bulk string reply

pub fn lpos(&mut self)[src]

The command returns the index of matching elements inside a Redis list.

pub fn lpush<K, E>(&mut self, key: K, elements: Vec<E>) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    E: RedisSerializationProtocol
[src]

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

Retrun value: Integer reply

pub fn lpushx<K, E>(&mut self, key: K, elements: Vec<E>) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    E: RedisSerializationProtocol
[src]

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

Return value: Integer value

pub fn lrange<K, E>(
    &mut self,
    key: K,
    start: isize,
    end: isize
) -> RedisResult<Vec<E>> where
    K: RedisSerializationProtocol,
    E: RedisDeserializationProtocol
[src]

Returns the specified elements of the list stored at key.

Return value: Array reply

pub fn lrem<K, E>(
    &mut self,
    key: K,
    count: isize,
    element: E
) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    E: RedisSerializationProtocol
[src]

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

Return value: Integer reply

pub fn lset<K, E>(
    &mut self,
    key: K,
    index: isize,
    element: E
) -> RedisResult<()> where
    K: RedisSerializationProtocol,
    E: RedisSerializationProtocol
[src]

Sets the list element at index to element.

Return value: Simple string reply

pub fn ltrim<K>(&mut self, key: K, start: isize, stop: isize) -> RedisResult<()> where
    K: RedisSerializationProtocol
[src]

Trim an existing list so that it will contain only the specified range of elements specified.

Return value: Simple string reply

pub fn rpop<K, E>(&mut self, key: K) -> RedisResult<E> where
    K: RedisSerializationProtocol,
    E: RedisDeserializationProtocol
[src]

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

Return value: Bulk string reply

pub fn rpoplpush<K, E>(&mut self, source: K, destination: K) -> RedisResult<E> where
    K: RedisSerializationProtocol,
    E: RedisDeserializationProtocol
[src]

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.

Return value: Bulk string reply

pub fn rpush<K, E>(&mut self, key: K, elements: Vec<E>) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    E: RedisSerializationProtocol
[src]

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

Return value: Integer value

pub fn rpushx<K, E>(&mut self, key: K, elements: Vec<E>) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    E: RedisSerializationProtocol
[src]

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

Return value: Integer reply

pub fn sadd<K, M>(&mut self, key: K, members: HashSet<M>) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    M: RedisSerializationProtocol + Hash + Eq
[src]

Add the specified members to the set stored at key.

Return value: Integer value

pub fn scard<K>(&mut self, key: K) -> RedisResult<usize> where
    K: RedisSerializationProtocol
[src]

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

Return value: Integer reply

pub fn sdiff<K, M>(&mut self, keys: Vec<K>) -> RedisResult<HashSet<M>> where
    K: RedisSerializationProtocol,
    M: RedisDeserializationProtocol + Hash + Eq
[src]

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

Return value: Array reply

pub fn sdiffstore<K>(
    &mut self,
    destination: K,
    keys: Vec<K>
) -> RedisResult<usize> where
    K: RedisSerializationProtocol + Hash + Eq
[src]

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

Return value: Integer reply

pub fn sinter<K, M>(&mut self, keys: Vec<K>) -> RedisResult<HashSet<M>> where
    K: RedisSerializationProtocol,
    M: RedisDeserializationProtocol + Hash + Eq
[src]

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

Return value: Array reply

pub fn sinterstore<K>(
    &mut self,
    destination: K,
    keys: Vec<K>
) -> RedisResult<usize> where
    K: RedisSerializationProtocol
[src]

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

Return value: Integer reply

pub fn sismember<K, M>(&mut self, key: K, member: M) -> RedisResult<bool> where
    K: RedisSerializationProtocol,
    M: RedisSerializationProtocol + Hash + Eq
[src]

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

Return value: Integer reply

pub fn smembers<K, M>(&mut self, key: K) -> RedisResult<HashSet<M>> where
    K: RedisSerializationProtocol,
    M: RedisDeserializationProtocol + Hash + Eq
[src]

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

Return value: Array reply

pub fn smismember<K, M>(
    &mut self,
    key: K,
    members: HashSet<M>
) -> RedisResult<Vec<bool>> where
    K: RedisSerializationProtocol,
    M: RedisSerializationProtocol + Hash + Eq
[src]

Returns whether each member is a member of the set stored at key.

Return value: Array reply

pub fn smove<K, M>(
    &mut self,
    source: K,
    destination: K,
    member: M
) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    M: RedisSerializationProtocol + Hash + Eq
[src]

Move member from the set at source to the set at destination.

Return value: Integer reply

pub fn spop<K, M>(&mut self, key: K, count: Option<usize>) -> RedisResult<M> where
    K: RedisSerializationProtocol,
    M: RedisDeserializationProtocol
[src]

Removes and returns one or more random members from the set value store at key.

Return value: Bulk string reply or Array reply

pub fn srandmember<K, M>(
    &mut self,
    key: K,
    count: Option<usize>
) -> RedisResult<M> where
    K: RedisSerializationProtocol,
    M: RedisDeserializationProtocol
[src]

When called with just the key argument, return a random element from the set value stored at key.

Return value: Bulk string reply or Array reply

pub fn srem<K, M>(&mut self, key: K, members: HashSet<M>) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    M: RedisSerializationProtocol + Hash + Eq
[src]

Remove the specified members from the set stored at key.

Return value: Integer reply

pub fn sscan()[src]

Like Scan command

pub fn sunion<K, M>(&mut self, keys: Vec<K>) -> RedisResult<HashSet<M>> where
    K: RedisSerializationProtocol,
    M: RedisDeserializationProtocol + Hash + Eq
[src]

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

Return value: Array reply

pub fn sunionstore<K>(
    &mut self,
    destination: K,
    keys: Vec<K>
) -> RedisResult<usize> where
    K: RedisSerializationProtocol
[src]

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

Return value: Integer reply

pub fn append<K, V>(&mut self, key: K, value: V) -> RedisResult<u64> where
    K: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

pub fn bitcount<K>(
    &mut self,
    key: K,
    start: Option<i64>,
    end: Option<i64>
) -> RedisResult<u64> where
    K: RedisSerializationProtocol
[src]

Count the number of set bits (population counting) in a string.

pub fn bitop<K1, K2>(
    &mut self,
    operation: &str,
    destkey: K1,
    keys: Vec<K2>
) -> RedisResult<usize> where
    K1: RedisSerializationProtocol,
    K2: RedisSerializationProtocol
[src]

Perform a bitwise operation between multiple keys (containing string values) and store the result in the destination key.

pub fn bitpos<K>(
    &mut self,
    key: K,
    bit: u8,
    start: Option<usize>,
    end: Option<usize>
) -> RedisResult<isize> where
    K: RedisSerializationProtocol
[src]

Return the position of the first bit set to 1 or 0 in a string.

pub fn decr<K>(&mut self, key: K) -> RedisResult<i64> where
    K: RedisSerializationProtocol
[src]

Decrements the number stored at key by one.

pub fn decrby<K>(&mut self, key: K, decrement: i64) -> RedisResult<i64> where
    K: RedisSerializationProtocol
[src]

Decrements the number stored at key by decrement.

pub fn get<K, V>(&mut self, key: K) -> RedisResult<V> where
    K: RedisSerializationProtocol,
    V: RedisDeserializationProtocol
[src]

Get the value of key.

pub fn getbit<K>(&mut self, key: K, offset: i64) -> RedisResult<u8> where
    K: RedisSerializationProtocol
[src]

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

pub fn getrange<K>(
    &mut self,
    key: K,
    start: i64,
    end: i64
) -> RedisResult<String> where
    K: RedisSerializationProtocol
[src]

Returns the substring of the string value stored at key, determined by the offsets start and end (both are inclusive).

pub fn getset<K, V>(&mut self, key: K, value: V) -> RedisResult<String> where
    K: RedisSerializationProtocol,
    V: ToString
[src]

Atomically sets key to value and returns the old value stored at key.

pub fn incr<K>(&mut self, key: K) -> RedisResult<i64> where
    K: RedisSerializationProtocol
[src]

Increments the number stored at key by one.

pub fn incrby<K>(&mut self, key: K, increment: i64) -> RedisResult<i64> where
    K: RedisSerializationProtocol
[src]

Increments the number stored at key by increment.

pub fn incrbyfloat<K>(&mut self, key: K, increment: f64) -> RedisResult<f64> where
    K: RedisSerializationProtocol
[src]

Increment the string representing a floating point number stored at key by the specified increment.

pub fn mget<K, V>(&mut self, keys: Vec<K>) -> RedisResult<Vec<V>> where
    K: RedisSerializationProtocol,
    V: RedisDeserializationProtocol
[src]

Returns the values of all specified keys.

pub fn mset<K, V>(&mut self, kvs: Vec<(K, V)>) -> RedisResult<()> where
    K: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Sets the given keys to their respective values.

pub fn msetnx<K, V>(&mut self, kvs: Vec<(K, V)>) -> RedisResult<()> where
    K: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Sets the given keys to their respective values.

pub fn psetex<K, V>(
    &mut self,
    key: K,
    milliseconds: u64,
    value: V
) -> RedisResult<()> where
    K: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

PSETEX works exactly like SETEX with the sole difference that the expire time is specified in milliseconds instead of seconds.

pub fn set<K, V>(
    &mut self,
    key: K,
    value: V,
    ex_seconds: Option<u64>,
    px_milliseconds: Option<u64>,
    nx: Option<bool>,
    xx: Option<bool>
) -> RedisResult<()> where
    K: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Set key to hold the string value.

pub fn simple_set<K, V>(&mut self, key: K, value: V) -> RedisResult<()> where
    K: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Set key to hold the string value.

pub fn setbit<K>(&mut self, key: K, offset: usize, value: u8) -> RedisResult<u8> where
    K: RedisSerializationProtocol
[src]

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

pub fn setex<K, V>(
    &mut self,
    key: K,
    seconds: usize,
    value: V
) -> RedisResult<()> where
    K: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Set key to hold the string value and set key to timeout after a given number of seconds.

pub fn setnx<K, V>(&mut self, key: K, value: V) -> RedisResult<bool> where
    K: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Set key to hold string value if key does not exist.

pub fn setrange<K, V>(
    &mut self,
    key: K,
    offset: usize,
    value: V
) -> RedisResult<usize> where
    K: RedisSerializationProtocol,
    V: RedisSerializationProtocol
[src]

Overwrites part of the string stored at key, starting at the specified offset, for the entire length of value.

pub fn strlen<K>(&mut self, key: K) -> RedisResult<u64> where
    K: RedisSerializationProtocol
[src]

Returns the length of the string value stored at key.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.