hiredis

Compile hiredis in C on Mac OS X

核能气质少年 提交于 2021-01-28 19:55:44
问题 I'm trying to compile a client using hiredis in C on Mac OS X . I've installed hiredis with: brew install hiredis But still get the error: fatal error: 'hiredis.h' file not found My hiredis.h is however in: /usr/local/include/hiredis/hiredis.c How do I tell the compiler this? I'm compiling with: gcc test.c -o test 回答1: In your question you said hiredis.h is in /usr/local/include/hiredis/hiredis.c , which doesn't really make any sense. Assuming you meant that your hiredis.h is in /usr/local

hiredis SET runs into segmentation fault

走远了吗. 提交于 2021-01-28 18:29:05
问题 I'm trying to SET a struct into Redis with hiredis: struct StatLite { uid_t uid; gid_t gid; mode_t mode; } bool RedisPermissionHandler::Set(std::string path, StatLite stat) { redisReply *reply = (redisReply*)redisCommand(this->redis, "SET %b %b", path.c_str(), (size_t)path.length(), stat, (size_t)sizeof(stat)); freeReplyObject(reply); return true; } However this runs into a segmentation fault somewhere inside hiredis. this->redis , path , and stat have proper values. GET commands work and

windows下面编译redis5.0.5

岁酱吖の 提交于 2020-03-14 04:55:23
先去弄Cygwin环境 http://www.cygwin.com/ 下载完成 打开 下一步 下一步 下一步 下一步 下一步,出现一个界面,让你添加地址,你打开官网,选择mirror sites,点击下面的 Hong Kong( http://mirror-hk.koddos.net/cygwin/ ) 把Hong Kong的地址填上,下一步,出现一个选择包的界面 搜索框里输入文字自动搜索,点击“New”的一列,有个那个下拉按钮,选择版本 还有automake 下一步 下一步 完成 双击桌面上的图标,启动 检查状态和版本 $ cygcheck -c cygwin Cygwin Package Information Package Version Status cygwin 3.0.7-1 OK 检查gcc $ gcc --version gcc (GCC) 7.4.0 Copyright © 2017 Free Software Foundation, Inc. 本程序是自由软件;请参看源代码的版权声明。本软件没有任何担保; 包括没有适销性和某一专用目的下的适用性担保。 检查make $ make --version GNU Make 4.2.1 为 x86_64-unknown-cygwin 编译 Copyright (C) 1988-2016 Free Software

windows下编译redis5.0+

纵饮孤独 提交于 2020-03-05 19:05:43
1、首先安装Cygwin, Cygwin传送 ,安装完成将目录加入环境变量。 注意:镜像的时候添加阿里的源,输入 ( http://mirrors.aliyun.com/cygwin/ ),然后点击旁边的Add。 要额外添加 make,gcc-core,gcc-g++ libgcc1 libgccpp1 2、下载 redis 源码,并解压到cygwin安装目录下的home文件夹 3、删除源码deps 目录下的hiredis 目录,并下载最新的代码 hiredis ,然后再hiredis目录执行 make 命令 4、进入lua的目录,执行 make generic 命令。 5、进入linenoise目录,执行 make 命令 6、以上都执行成功,回到redis根目录执行执行 make 命令。 注:如果编译后的redis文件,复制到其他没有安装cygwin环境的机器,则需要复制 cygwin安装目录下bin目录下的cygwin1.dll到redis运行目录 执行成功,会在redis/src目录看到redis相关的exe文件,执行redis-server.exe,看到redis启动则说明编译成功。 来源: oschina 链接: https://my.oschina.net/liucy99/blog/3188688

Hiredis waiting for message

旧街凉风 提交于 2019-12-31 03:16:30
问题 I am using hiredis C library to connect to redis server. I am not able to figure out how to wait for new messages after subscribing to new message. My code look like: signal(SIGPIPE, SIG_IGN ); struct event_base *base = event_base_new(); redisAsyncContext *c = redisAsyncConnect("127.0.0.1", 6379); if (c->err) { /* Let *c leak for now... */ printf("Error: %s\n", c->errstr); return 1; } redisLibeventAttach(c, base); redisAsyncSetConnectCallback(c, connectCallback);

How to use HSCAN command in Redis?

痞子三分冷 提交于 2019-12-22 04:45:09
问题 I want to use Redis's HSCAN command in my assignment but I have no idea how it works. Redis's official page (http://redis.io/commands/hscan) for this command gives me blank page. I am getting continuous input data and saving them instantaneously in multiple hashes in Redis and I would like to iterate through all of them at later point of time. I'm using following command to save my data HMSET myhash ordertype "neworder" order_ts "1234" act_type "order_ack" ack_ts "1240" HMSET myhash2