Questions tagged [hiredis]

Hiredis is a minimalistic C client library for the Redis database

Hiredis is a minimalistic C client library for the Redis database.

It is minimalistic because it just adds minimal support for the protocol, but at the same time it uses an high level printf-alike API in order to make it much higher level than otherwise suggested by its minimal code base and the lack of explicit bindings for every Redis command.

Apart from supporting sending commands and receiving replies, it comes with a reply parser that is decoupled from the I/O layer. It is a stream parser designed for easy reusability, which can for instance be used in higher level language bindings for efficient reply parsing.

Hiredis only supports the binary-safe Redis protocol, so you can use it with any Redis version >= 1.2.0.

The library comes with multiple APIs. There is the synchronous API, the asynchronous API and the reply parsing API.

Source Code: https://github.com/redis/hiredis

139 questions
2
votes
1 answer

Closing connection in hiredis?

How to disconnect to redis server using hiredis API? There is API to connect but I can't find any function to close the connection? Does redisFree will automatically do this ?
Vivek Goel
  • 22,942
  • 29
  • 114
  • 186
1
vote
1 answer

Can I use MGET with hiredis?

Consider following example: #include #include #include #include int main(int argc, char **argv) { redisContext *redis; redisReply *reply; redis = redisConnect("127.0.0.1", 6379); …
Sebastian Sito
  • 163
  • 3
  • 10
1
vote
0 answers

Fastest possible way to fetch data from database using HIREDIS

I have a database of around 40GB in memory (I have allotted 42GB ram to redis server) on a server containing 40,000,000 redis hashes and I want to now perform HGETALL on these hashes using redis client. What would be the fastest way possible to…
1
vote
0 answers

Escaping user data for redis, needed?

While using https://github.com/sewenew/redis-plus-plus as library for talking to redis, the following question came up. How would you escape user send data, which should be saved as a value of e.g. a json object (in order to not allow redis command…
user1347198
1
vote
1 answer

Pip install hiredis fails on building wheels

I upgraded my python to version 3.10, but when I was installing dependencies for one of my projects (which worked fine before), I got this error from hiredis (hiredis==2.0.0): ERROR: Command errored out with exit status 1: command:…
Sajad Rezvani
  • 366
  • 2
  • 14
1
vote
1 answer

hiredis C API : reply for HMSET vs HSET

When I execute HMSET the reply contains string "OK" in success case. However with HSET, reply->str is null. Is there any particular reason for this difference? In case of error, both seems to give error string in reply. I wanted to confirm what are…
m.divya.mohan
  • 2,261
  • 4
  • 24
  • 34
1
vote
1 answer

How do redis increment commands react to overflow?

In redis integer increment commands, more specifically: INCR / INCRBY HINCRBY what is the behavior when incrementing 1-past the maximum value (ie 64bit signed range)?
Lorah Attkins
  • 5,331
  • 3
  • 29
  • 63
1
vote
1 answer

Docker container can't connect to Redis

I have a Docker container running a C application using hiredis, which should write data to a Redis server exposed at the default address and port running locally on the same Linux device at 127.0.0.1:6379 . The Redis server is running in a…
Engineer999
  • 3,683
  • 6
  • 33
  • 71
1
vote
0 answers

Can two diffrent keys store the same data without duplicate in Redis C++

I want that two different keys hold the same data without duplicat this data. for example: key1 and key2 holds the same hash (without duplicat it in memory) There such a way to do it in Redis?
MoranLev
  • 33
  • 4
1
vote
1 answer

Error installing recommendify gem - Failed to build gem native extension (hiredis.h no such file or directory)

Im using windows 10 on this project with ruby version 2.6.5 and rails version 6.0.2 with bundler version 2.1.4. However if I tried bundle install including gem 'recommendify', it will fail. I tried deleting the old lock file then executing bundle…
dev test
  • 123
  • 1
  • 10
1
vote
1 answer

custom redis-client compilation failing

I've build a custom redis-client using hiredis library, but while compiling it throws below error: example.c:4:10: fatal error: hiredis.h: No such file or directory 4 | #include Need help in resolving this issue. How did i build…
user14610638
  • 161
  • 7
1
vote
1 answer

C++ libhiredis with libev and custom event loop

My application uses libhiredis with libev backend. I need to send Redis async commands and process the resulting Redis async callback. However, unlike the simple example from here I cannot use the default event loop. The following code approximates…
Paul Grinberg
  • 1,184
  • 14
  • 37
1
vote
1 answer

Does 'hiredis' support Redis Sentinel and Redis Cluster?

'hiredis' is a minimalistic C client for Redis. Does anyone know if it supports - Redis Sentinel (the official high availability solution for Redis) https://redis.io/topics/sentinel and Redis Cluster https://redis.io/topics/cluster-tutorial It is…
smulkutk
  • 71
  • 9
1
vote
2 answers

RedisGraph Syntax error at offset 8 near 'CREATE'

I use hiredis library in my c++ code to execute RedisGraph commands. When I try to execute 'create' command in c++ code it throws an error, but when i execute exactly the same command in command line it works fine. What's going on? Maybe i do…
BigNoob
  • 11
  • 1
1
vote
1 answer

hiredis async connect with password

I am using hiredis C library to connect to my redis instance. I am considering changing my redis.conf to enable requirepass option. I know that for redisConnect() I simply connect to host/port without authentication, and then send the AUTH…
Paul Grinberg
  • 1,184
  • 14
  • 37
1 2
3
9 10