neophenix / redis-hiredis Goto Github PK
View Code? Open in Web Editor NEWPerl wrapper around hiredis client
License: BSD 3-Clause "New" or "Revised" License
Perl wrapper around hiredis client
License: BSD 3-Clause "New" or "Revised" License
I´m using Redis::hiredis inside a mod_perl module on an Apache with more than 1000 domains.
That leads the program to have more than 1024 opened file descriptors what trigger a bug in net.c where redisContextWaitReady() call select with FD_SETSIZE, that's generally 1024 in most operating systems, making select call never return.
That was corrected less than a month ago in https://github.com/antirez/hiredis/commits/master/net.c substituting sellect by poll call.
I've done a test updating the entire net.c with lastest from antirez repo and the problem does not happen anymore.
Can you update the module ?
Regards,
Alexandre
SV * _read_bulk_reply (Redis__hiredis self, redisReply *reply) {
SV *sv;
if ( reply->type == REDIS_REPLY_ERROR ) {
croak("%s",reply->str);
}
When you use MULTI/EXEC, bulk replies can include errors.
I have a distribution called Alien::hiredis which could be used by this module. See Alien for an overview of the Alien ecosystem, but the basic advantages are that the task of building and updating the hiredis library is outsourced to that module, and it can even allow you to build against a system version of hiredis if it is appropriate.
All you would need to do is use it like described here (I can provide a PR if you wish). Right now it requires hiredis 0.11.0 or newer, with an exception to disallow a system version of 0.13.0 which is a broken version. In other cases it will install a custom version of the library for Perl to use. This is configured by the alienfile.
You would not be able to affect what criteria it uses to determine whether to use the system version or install a new one, but it could be adjusted if needed, and you can conditionally fail to install based on the alien library version.
Just presenting this option in case you want to let something else worry about installing or updating the library, and allow usage of system hiredis. Thanks for your consideration.
I have used the Redis::hiredis module on many Linux systems, but now that I developing on a OS X Mountain Lion I am receiving the following error when I attempt to make
the module. Potentially an issue with compiling with clang over gcc?
> perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for Redis::hiredis
> make
cp lib/Redis/hiredis.pm blib/lib/Redis/hiredis.pm
/usr/bin/perl /System/Library/Perl/5.12/ExtUtils/xsubpp -typemap /System/Library/Perl/5.12/ExtUtils/typemap -typemap typemap Redis-hiredis.xs > Redis-hiredis.xsc && mv Redis-hiredis.xsc Redis-hiredis.c
Please specify prototyping behavior for Redis-hiredis.xs (see perlxs manual)
clang -c -arch i386 -arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include -Os -DVERSION=\"0.10.2\" -DXS_VERSION=\"0.10.2\" "-I/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE" Redis-hiredis.c
clang -c -arch i386 -arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include -Os -DVERSION=\"0.10.2\" -DXS_VERSION=\"0.10.2\" "-I/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE" dict.c
clang -c -arch i386 -arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -I/usr/local/include -Os -DVERSION=\"0.10.2\" -DXS_VERSION=\"0.10.2\" "-I/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE" hiredis.c
hiredis.c:799:31: error: second argument to 'va_arg' is of incomplete type 'void'
va_arg(ap,void);
~~~~~~~~~~^~~~~
/usr/bin/../lib/clang/4.1/include/stdarg.h:35:50: note: expanded from macro 'va_arg'
#define va_arg(ap, type) __builtin_va_arg(ap, type)
^
1 error generated.
make: *** [hiredis.o] Error 1
Hello, great module :)
Redisearch command works but some of the results are marked as 'undef'.
https://oss.redislabs.com/redisearch/Quick_Start.html
git clone --recursive https://github.com/RediSearch/RediSearch.git
cd RediSearch
make build
make run
use Redis::hiredis;
use Data::Dumper;
my $redis = Redis::hiredis->new();
$redis->connect('127.0.0.1', 6379);
# create index
$redis->command("FT.CREATE my_index SCHEMA title TEXT body TEXT");
# add documents
$redis->command("FT.ADD my_index doc1 1.0 FIELDS title foo body bar");
$redis->command("FT.ADD my_index doc2 1.0 FIELDS title foo_2 body bar_2");
# search
my $search = $redis->command("FT.SEARCH my_index foo");
print Dumper(\$search);
$VAR1 = \[
1,
'doc1',
undef
];
On redis-cli I get.
1) (integer) 1
2) "doc1"
3) 1) "title"
2) "foo"
3) "body"
4) "bar"
Looks like some array are not getting parsed. Redisearch is pretty great and we have 0 perl client, a fix would be appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.