File Redis.h
-
namespace faabric
-
namespace redis
Typedefs
-
using UniqueRedisReply = std::unique_ptr<redisReply, decltype(&freeReplyObject)>
-
class Redis
Public Functions
-
~Redis()
-
void ping()
—— Standard Redis commands ——
-
std::vector<uint8_t> get(const std::string &key)
-
size_t strlen(const std::string &key)
-
void get(const std::string &key, uint8_t *buffer, size_t size)
-
void set(const std::string &key, const std::vector<uint8_t> &value)
-
void set(const std::string &key, const uint8_t *value, size_t size)
-
void del(const std::string &key)
-
long getCounter(const std::string &key)
-
long incr(const std::string &key)
-
long decr(const std::string &key)
-
long incrByLong(const std::string &key, long val)
-
long decrByLong(const std::string &key, long val)
-
void setRange(const std::string &key, long offset, const uint8_t *value, size_t size)
-
void setRangePipeline(const std::string &key, long offset, const uint8_t *value, size_t size)
-
void flushPipeline(long pipelineLength)
-
void getRange(const std::string &key, uint8_t *buffer, size_t bufferLen, long start, long end)
Note that start/end are both inclusive
-
void sadd(const std::string &key, const std::string &value)
-
void srem(const std::string &key, const std::string &value)
-
long scard(const std::string &key)
-
bool sismember(const std::string &key, const std::string &value)
-
std::string srandmember(const std::string &key)
-
std::set<std::string> smembers(const std::string &key)
-
std::set<std::string> sdiff(const std::string &keyA, const std::string &keyB)
-
std::set<std::string> sinter(const std::string &keyA, const std::string &keyB)
-
int lpushLong(const std::string &key, long val)
-
int rpushLong(const std::string &key, long val)
-
void flushAll()
-
long listLength(const std::string &queueName)
-
long getTtl(const std::string &key)
-
void expire(const std::string &key, long expiry)
-
void refresh()
-
uint32_t acquireLock(const std::string &key, int expirySeconds)
—— Locking ——
-
void releaseLock(const std::string &key, uint32_t lockId)
-
void delIfEq(const std::string &key, uint32_t value)
-
bool setnxex(const std::string &key, long value, int expirySeconds)
-
long getLong(const std::string &key)
-
void setLong(const std::string &key, long value)
-
void enqueue(const std::string &queueName, const std::string &value)
—— Queueing ——
-
void enqueueBytes(const std::string &queueName, const std::vector<uint8_t> &value)
-
void enqueueBytes(const std::string &queueName, const uint8_t *buffer, size_t bufferLen)
-
std::string dequeue(const std::string &queueName, int timeout = DEFAULT_TIMEOUT)
-
std::vector<uint8_t> dequeueBytes(const std::string &queueName, int timeout = DEFAULT_TIMEOUT)
-
size_t dequeueBytes(const std::string &queueName, uint8_t *buffer, size_t bufferLen, int timeout = DEFAULT_TIMEOUT)
-
void dequeueMultiple(const std::string &queueName, uint8_t *buff, long buffLen, long nElems)
-
void publishSchedulerResult(const std::string &key, const std::string &status_key, const std::vector<uint8_t> &result)
Public Static Functions
-
static Redis &getQueue()
—— Factories ——
-
static Redis &getState()
—— Utils ——
Private Functions
-
explicit Redis(const RedisInstance &instance)
-
UniqueRedisReply dequeueBase(const std::string &queueName, int timeout)
-
~Redis()
-
class RedisInstance
Public Functions
-
explicit RedisInstance(RedisRole role)
Public Members
-
std::string delifeqSha
-
std::string schedPublishSha
-
std::string ip
-
std::string hostname
-
int port
Private Functions
-
std::string loadScript(redisContext *context, const std::string_view scriptBody)
Private Members
-
std::mutex scriptsLock
- const std::string_view delifeqCmd = R"---(if redis.call('GET', KEYS[1]) == ARGV[1] thenreturn redis.call('DEL', KEYS[1])elsereturn 0end)---"
- const std::string_view schedPublishCmd = R"---(local key = KEYS[1]local status_key = KEYS[2]local result = ARGV[1]local result_expiry = tonumber(ARGV[2])local status_expiry = tonumber(ARGV[3])redis.call('RPUSH', key, result)redis.call('EXPIRE', key, result_expiry)redis.call('SET', status_key, result)redis.call('EXPIRE', status_key, status_expiry)return 0)---"
-
explicit RedisInstance(RedisRole role)
-
class RedisNoResponseException : public faabric::util::FaabricException
Public Functions
-
inline explicit RedisNoResponseException(std::string message)
-
inline explicit RedisNoResponseException(std::string message)
-
using UniqueRedisReply = std::unique_ptr<redisReply, decltype(&freeReplyObject)>
-
namespace redis