TreeFrogFramework
2.8
|
#include <tredis.h>
Public Member Functions | |
TRedis () | |
virtual | ~TRedis () |
bool | isOpen () const |
bool | exists (const QByteArray &key) |
QByteArray | get (const QByteArray &key) |
bool | set (const QByteArray &key, const QByteArray &value) |
bool | setEx (const QByteArray &key, const QByteArray &value, int seconds) |
bool | setNx (const QByteArray &key, const QByteArray &value) |
QByteArray | getSet (const QByteArray &key, const QByteArray &value) |
QString | gets (const QByteArray &key) |
bool | sets (const QByteArray &key, const QString &value) |
bool | setsEx (const QByteArray &key, const QString &value, int seconds) |
bool | setsNx (const QByteArray &key, const QString &value) |
QString | getsSets (const QByteArray &key, const QString &value) |
bool | del (const QByteArray &key) |
int | del (const QByteArrayList &keys) |
int | rpush (const QByteArray &key, const QByteArrayList &values) |
int | lpush (const QByteArray &key, const QByteArrayList &values) |
QByteArrayList | lrange (const QByteArray &key, int start, int end) |
QByteArray | lindex (const QByteArray &key, int index) |
int | rpushs (const QByteArray &key, const QStringList &values) |
int | lpushs (const QByteArray &key, const QStringList &values) |
QStringList | lranges (const QByteArray &key, int start, int end) |
QString | lindexs (const QByteArray &key, int index) |
int | llen (const QByteArray &key) |
bool | hset (const QByteArray &key, const QByteArray &field, const QByteArray &value) |
bool | hsetNx (const QByteArray &key, const QByteArray &field, const QByteArray &value) |
bool | hsets (const QByteArray &key, const QByteArray &field, const QString &value) |
bool | hsetsNx (const QByteArray &key, const QByteArray &field, const QString &value) |
QByteArray | hget (const QByteArray &key, const QByteArray &field) |
QString | hgets (const QByteArray &key, const QByteArray &field) |
bool | hexists (const QByteArray &key, const QByteArray &field) |
bool | hdel (const QByteArray &key, const QByteArray &field) |
int | hdel (const QByteArray &key, const QByteArrayList &fields) |
int | hlen (const QByteArray &key) |
QList< QPair< QByteArray, QByteArray > > | hgetAll (const QByteArray &key) |
void | flushDb () |
Friends | |
class | TCacheRedisStore |
The TRedis class provides a means of operating a Redis system.
Edit conf/redis.ini and conf/application.ini to use this class.
redis.ini:
application.ini:
TRedis::TRedis | ( | ) |
Constructs a TRedis object.
|
inlinevirtual |
bool TRedis::del | ( | const QByteArray & | key | ) |
Removes the specified key.
A key is ignored if it does not exist.
int TRedis::del | ( | const QByteArrayList & | keys | ) |
Removes the specified keys.
A key is ignored if it does not exist.
bool TRedis::exists | ( | const QByteArray & | key | ) |
Returns true if the key exists; otherwise returns false.
void TRedis::flushDb | ( | ) |
QByteArray TRedis::get | ( | const QByteArray & | key | ) |
Returns the value associated with the key; otherwise returns an empty byte array.
|
inline |
Returns the string associated with the key; otherwise returns a null string.
QByteArray TRedis::getSet | ( | const QByteArray & | key, |
const QByteArray & | value | ||
) |
Atomically sets the key to the value and returns the old value stored at the key.
|
inline |
Atomically sets the key to the string value and returns the old string value stored at the key.
bool TRedis::hdel | ( | const QByteArray & | key, |
const QByteArray & | field | ||
) |
int TRedis::hdel | ( | const QByteArray & | key, |
const QByteArrayList & | fields | ||
) |
bool TRedis::hexists | ( | const QByteArray & | key, |
const QByteArray & | field | ||
) |
QByteArray TRedis::hget | ( | const QByteArray & | key, |
const QByteArray & | field | ||
) |
QList< QPair< QByteArray, QByteArray > > TRedis::hgetAll | ( | const QByteArray & | key | ) |
|
inline |
int TRedis::hlen | ( | const QByteArray & | key | ) |
bool TRedis::hset | ( | const QByteArray & | key, |
const QByteArray & | field, | ||
const QByteArray & | value | ||
) |
bool TRedis::hsetNx | ( | const QByteArray & | key, |
const QByteArray & | field, | ||
const QByteArray & | value | ||
) |
|
inline |
|
inline |
bool TRedis::isOpen | ( | ) | const |
Returns true if the Redis connection is open; otherwise returns false.
QByteArray TRedis::lindex | ( | const QByteArray & | key, |
int | index | ||
) |
Returns the element at the index in the list stored at the key.
|
inline |
Returns the string at the index in the list stored at the key.
int TRedis::llen | ( | const QByteArray & | key | ) |
Returns the length of the list stored at the key.
int TRedis::lpush | ( | const QByteArray & | key, |
const QByteArrayList & | values | ||
) |
Inserts all the values at the tail of the list stored at the key.
Returns the length of the list after the push operation.
|
inline |
Inserts all the string values at the tail of the list stored at the key.
Returns the length of the list after the push operation.
QByteArrayList TRedis::lrange | ( | const QByteArray & | key, |
int | start, | ||
int | end = -1 |
||
) |
Returns the specified elements of the list stored at the key.
|
inline |
Returns the specified elements of the list stored at the key.
int TRedis::rpush | ( | const QByteArray & | key, |
const QByteArrayList & | values | ||
) |
Inserts all the values at the tail of the list stored at the key.
Returns the length of the list after the push operation.
|
inline |
Inserts all the string values at the tail of the list stored at the key.
Returns the length of the list after the push operation.
bool TRedis::set | ( | const QByteArray & | key, |
const QByteArray & | value | ||
) |
Sets the key to hold the value.
If the key already holds a value, it is overwritten, regardless of its type.
bool TRedis::setEx | ( | const QByteArray & | key, |
const QByteArray & | value, | ||
int | seconds | ||
) |
Sets the key to hold the value and set the key to timeout after a given number of seconds.
bool TRedis::setNx | ( | const QByteArray & | key, |
const QByteArray & | value | ||
) |
Set the key to hold the value if key does not exist.
In that case, it is equal to SET. When key already holds a value, no operation is performed.
|
inline |
Sets the key to hold the string value.
If the key already holds a value, it is overwritten, regardless of its type.
|
inline |
Sets the key to hold the string value and set the key to timeout after a given number of seconds.
|
inline |
|
friend |