C++ | Poco::Redis::Command functions














































C++ | Poco::Redis::Command functions



Library: Redis

Package: Redis

Header: Poco/Redis/Command.h


Member function(s) of Command class - 


sismember


static Command sismember(

    const std::string & set,

    const std::string & member

);

Returns %u20181%u2019 if it is memeber of the set stored at key or else returnn %u20180%u2019 . This function creates and returns the sismember command.



smember


static Command smembers(

    const std::string & set

);

It returns all the members of the set value stored at key. This function creates and returns smember command.



smove


static Command smove(

    const std::string & source,

    const std::string & destination,

    const std::string & member

);

Move member from the set at source to the set at destination. It returns %u20181%u2019 if it is moved successfully or else returns %u20180%u2019 on failure. This function creates and returns smove command. 



spop


static Command spop(

    const std::string & set,

    Int64 count = 0

);

Removes and returns one or more random members from the set value store at key. If the count argument is not provided it returns bulk string or else returns array of removed members. This function creates and returns spop command. 



srandmember


static Command srandmember(

    const std::string & set,

    Int64 count = 0

);

When called with just the key argument, return a random element from the set value stored at key.  If the count argument is not provided it returns a bulk string or else returns an array of removed members. This function creates and returns srandmember command. 



srem


static Command srem(

    const std::string & set,

    const std::string & member

);

Remove the specified members from the set stored at key. It returns integer value which is the number of elements removed from the set. This function creates and returns the srem command.



sunion


static Command sunion(

    const std::string & set,

    const StringVec & sets

);

It does the union of all the sets and returns the list of elements in the resulting set. This command Creates and returns the sunion command.



sunionstore


There are two different syntax for this which are as follows-

static Command sunionstore(

    const std::string & set,

    const std::string & set1,

    const std::string & set2

);


Or


static Command sunionstore(

    const std::string & set,

    const StringVec & sets

);

It works the same as sunion but instead of returning the array of the resulting set it stores it to the destination and returns the integer value which is the number of elements in the resulting array. This function creates and returns sunionstore command.


To know more about other member functions of command class click here.


Reference : https://pocoproject.org/docs/Poco.Redis.Command.html



Comments