zhulangren / credis Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/credis
Automatically exported from code.google.com/p/credis
Credis (http://code.google.com/p/credis) is a client library in plain C written by Jonas Romfelt (jonas at romfelt dot se) for communicating with Redis (http://code.google.com/p/redis) servers. Redis is a high performance key-value database, refer to Redis project page for more information. Credis aims to be fast and minimalistic with respect to memory usage. It runs on Linux and should run on most posix like systems. Porting it to Windows or other platforms should be straightforward. To build credis-test and credis shared and static libraries simply unpack and run: make To run through a number of credis tests run (presupposed that a Redis server is listening on the default port on localhost): ./credis-test To perform a simplistic performance benchmark test and measure number of set-commands per second, run: ./credis-test 10000 Where 10000 is the number of set-commands to execute. Running the benchmark and a redis srver instance locally on my machine (old dual-core AMD64 and 2 GB RAM running Debian) roughly results in 33000 commands/second. Slightly (10-15%) faster than the benchmark provided with the redis server.
I'm using credis 0.2.3 on redis 2.0.0. my problem: credis_keys returns -97!
char **v;
int ret;
ret = credis_keys( redis, "name:*", &v );
--> ret = -97
Original issue reported on code.google.com by [email protected]
on 5 Sep 2010 at 7:20
When in a publisher/subscriber schema some published messages may be lost with
curren implementation of cr_readln
I attach two test files, one is a publisher, and the oter is a subscriber. Just
compile and launch the subscriber before publisher.
*Some frames get lost because of line
rc = cr_receivedata(rhnd->fd, rhnd->timeout, buf->data + buf->len, avail);
When filling the buffer, it can be populated with more than a message. Only
first message gets parsed and other messages are lost.
If that line is modified to
rc = cr_receivedata(rhnd->fd, rhnd->timeout, buf->data + buf->len, 1);
Recompile and run the same test, shows no message lost.
Some speed will be lost with this patch (i haven't bencharmked this, and
probably won't do) but no message will be lost.
I think that is a trade off between speed and fiability.
Tests and patch are provided.
Any other implementation with no speed lost will be welcome.
Original issue reported on code.google.com by [email protected]
on 24 Apr 2012 at 1:44
Attachments:
Would you like to bloat your makefile a little?
It shouldn't break anything. I guess adding configure
would be overkill.
Cheers
Original issue reported on code.google.com by [email protected]
on 9 Nov 2010 at 12:24
Attachments:
HDEL is missing.
This patch adds hdel code to credis.c and credis.h
Please check compatibility with old redis API. Should be the same but i haven't
tested against old redis versions.
Original issue reported on code.google.com by [email protected]
on 8 May 2012 at 7:07
Attachments:
I have attached a demo script of the problems with larger lists.
I have two main problems:
1) credis_lrange() doesn't return the list entries correctly. It seems that the
entries get mixed.
2) if CR_BUFFER_SIZE ist set too low, you will get a Program received signal:
“EXC_BAD_ACCESS”
error.
It would be awesome if you could fix that. This is really a blocker for me now.
Original issue reported on code.google.com by [email protected]
on 9 Feb 2010 at 7:50
Attachments:
What steps will reproduce the problem?
1. credis_zincrby(rh, "mykey", 1.0, "mymember", &new_score)
2. ZRANGE mykey 0 -1 (in telnet connect to server)
What is the expected output? What do you see instead?
I would expect something like:
*1
$8
mymember
Instead I get:
*1
$1
8
What version of the product are you using? On what operating system?
credis 0.2.3
redis 2.2.2
Please provide any additional information below.
It appears that credis increases the score of strlen("mymember") rather than
"mymember".
Original issue reported on code.google.com by [email protected]
on 15 Mar 2011 at 5:19
the latest redis provide 'append' command to maintain a string value, here
is a simple patch to support it
http://code.google.com/p/rediscache/source/detail?r=7
Original issue reported on code.google.com by [email protected]
on 9 May 2010 at 8:14
What steps will reproduce the problem?
1. cr_push(redis, "mykey", "myvalue");
What is the expected output? What do you see instead?
Redis monitor shows:
RPUSH mykey 0
It should show:
RPUSH mykey 7
myvalue
What version of the product are you using? On what operating system?
SVN r13
Please provide any additional information below.
FIX:
In credis.c replace line 747 with this:
int rc = cr_sendfandreceive(rhnd, CR_INT, "%s %s %d\r\n%s\r\n",
left==1?"LPUSH":"RPUSH", key, strlen(val), val);
Original issue reported on code.google.com by [email protected]
on 9 Feb 2010 at 2:12
1>------ Build started: Project: credis, Configuration: Debug Win32 ------
1>Compiling...
1>credis-test.c
1>e:\credis\credis-test.c(35) : fatal error C1083: Cannot open include file:
'sys/time.h': No such file or directory
1>credis.c
1>e:\credis\credis.c(786) : error C2143: syntax error : missing ';' before
'type'
1>e:\credis\credis.c(791) : error C2065: 'he' : undeclared identifier
1>e:\credis\credis.c(791) : warning C4047: '=' : 'int' differs in levels of
indirection from 'hostent *'
1>e:\credis\credis.c(793) : error C2065: 'he' : undeclared identifier
1>e:\credis\credis.c(793) : warning C4047: '=' : 'int' differs in levels of
indirection from 'hostent *'
1>e:\credis\credis.c(795) : error C2065: 'he' : undeclared identifier
1>e:\credis\credis.c(795) : warning C4047: '==' : 'int' differs in levels of
indirection from 'void *'
1>e:\credis\credis.c(798) : error C2065: 'he' : undeclared identifier
1>e:\credis\credis.c(798) : error C2223: left of '->h_addr_list' must point to
struct/union
1>e:\credis\credis.c(798) : warning C4022: 'memcpy' : pointer mismatch for
actual parameter 2
1>e:\credis\credis.c(798) : error C2198: 'memcpy' : too few arguments for call
1>e:\credis\credis.c(817) : warning C4013: 'fcntl' undefined; assuming extern
returning int
1>e:\credis\credis.c(817) : error C2065: 'F_GETFL' : undeclared identifier
1>e:\credis\credis.c(818) : error C2065: 'F_SETFL' : undeclared identifier
1>e:\credis\credis.c(818) : error C2065: 'O_NONBLOCK' : undeclared identifier
1>e:\credis\credis.c(823) : error C2065: 'EINPROGRESS' : undeclared identifier
1>e:\credis\credis.c(829) : warning C4133: 'function' : incompatible types -
from 'int *' to 'char *'
1>e:\credis\credis.c(1860) : warning C4013: 'strcasecmp' undefined; assuming
extern returning int
1>Generating Code...
1>Project : warning PRJ0018 : The following environment variables were not
found:
1>$(hge)
1>Build log was saved at "file://e:\credis\Debug\BuildLog.htm"
1>credis - 12 error(s), 7 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Original issue reported on code.google.com by [email protected]
on 27 Nov 2011 at 8:52
I suggest you realization of some redis commands that I need in my project.
There are SETEX, HKEYS, HLEN and HMGET commands.
Original issue reported on code.google.com by [email protected]
on 11 Mar 2011 at 2:51
Attachments:
RPUSH key string
LPUSH key string
Time complexity: O(1)
Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at
key. If the key does not exist an empty list is created just before the append
operation. If the key exists but is not a List an error is returned.
Return value
Integer reply, specifically, the number of elements inside the list after the
push operation.
Original issue reported on code.google.com by [email protected]
on 15 Sep 2010 at 8:47
What steps will reproduce the problem?
1.start redis-server under cygwin
2../credis-test.exe
What is the expected output? What do you see instead?
For "info" result, the expected output is:
$ telnet 127.0.0.1 6379
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
info
$390
redis_version:1.2.3
arch_bits:32
multiplexing_api:select
uptime_in_seconds:744
uptime_in_days:0
connected_clients:1
connected_slaves:0
used_memory:311100
used_memory_human:303.81K
changes_since_last_save:0
bgsave_in_progress:0
last_save_time:1267772385
bgrewriteaof_in_progress:0
total_connections_received:5
total_commands_processed:25561
role:master
db0:keys=6,expires=0
However, the credist-test giving the result:
$ ./credis-test.exe
Testing a number of credis functions. To perform a simplistic
benchmark, run: `./credis-test <num>' where <num> is the numbe
of set-commands to send.
************* misc info ************************************
ping returned: 0
lastsave returned: 1267772385
info returned -97
>redis_version: 1.2.3
>uptime_in_seconds: 1628878521
>uptime_in_days: 2281060
>connected_clients: 0
>connected_slaves: 2280632
>used_memory: 1627480722
>changes_since_last_save: 5922451296
>bgsave_in_progress: 1628867192
>last_save_time: 0
>total_connections_received: 8589934592
>total_commands_processed: 6989927294192242072
>role: 2280680
What version of the product are you using? On what operating system?
credis-0.2 / cygwin
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 5 Mar 2010 at 7:12
What steps will reproduce the problem?
1. Make a simple program to get a key, then get the type of the key. Then
output both.
2.
3.
What is the expected output? What do you see instead?
I expect to see the true value of the key. Instead, the key returns something
different, namely
'ing'.
What version of the product are you using? On what operating system?
0.2.1
mac os x 10.6
Please provide any additional information below.
#include <stdio.h>
#include "credis.h"
int main(int argc, char **argv)
{
REDIS redis = credis_connect(NULL, 0, 10000);
char *val;
credis_get(redis, "name", &val);
int type = credis_type(redis, "name");
printf("type: %d\n", type);
printf("val: %s\n", val);
credis_close(redis);
return 0;
}
Original issue reported on code.google.com by [email protected]
on 12 May 2010 at 2:45
What steps will reproduce the problem?
1. int returnValue = credis_lrange(redis,"not_existing",0,-1);
What is the expected output? What do you see instead?
If the key does not exist returnValue is -97 and I get strange memory issues.
Also the program
hangs for a while.
What version of the product are you using? On what operating system?
SVN r13
Please provide any additional information below.
I think the problem is somewhere in the cr_receivedata() method.
Original issue reported on code.google.com by [email protected]
on 9 Feb 2010 at 3:49
What steps will reproduce the problem?
1. #include "credis.h"
2. write code calling credis_quit()
3. link!
What is the expected output? What do you see instead?
It should link and send QUIT command to server!
What version of the product are you using? On what operating system?
I'm on revision r66
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 23 Apr 2012 at 2:50
Linking with c++ sources is currently not possible. This should be added to
credis.h :
#if defined(__cplusplus)
#define __CREDIS_CLINKAGEBEGIN extern "C" {
#define __CREDIS_CLINKAGEEND }
#else
#define __CREDIS_CLINKAGEBEGIN
#define __CREDIS_CLINKAGEEND
#endif
__CREDIS_CLINKAGEBEGIN
[...]
__CREDIS_CLINKAGEEND
Also, some function could take a const char*, instead of a char* (eg: 2nd
argument of credis_get). This would avoid using a const_cast in c++.
Original issue reported on code.google.com by [email protected]
on 7 Dec 2009 at 6:36
What steps will reproduce the problem?
1. using credis_lrange(redis,"myList",0,-1,&elements); on large lists
What is the expected output? What do you see instead?
It works most of the time but on every 3./4. call the function returns -95, -97
or displays: more
data needed.
What version of the product are you using? On what operating system?
credis 0.1
Please provide any additional information below.
To receive any data I had to set:
#define CR_BUFFER_SIZE 2048
#define CR_MULTIBULK_SIZE 2048
Original issue reported on code.google.com by [email protected]
on 8 Feb 2010 at 9:46
Key searches are returned as a space separated list of key names, in a single
string. Therefore, it has to use CR_BULK instead of CR_MULTIBULK, and parse
the string.
Original issue reported on code.google.com by mathieu.rene
on 13 Mar 2010 at 9:14
Attachments:
What steps will reproduce the problem?
Using credis_keys and credis_rpush
to get CREDIS_ERR_PROTOCOL
What is the expected output? What do you see instead?
expect:
Get results as the redis-cli
getting:
Error in keys functions and rpush function:
CREDIS_ERR_PROTOCOL
What version of the product are you using? On what operating system?
redis-server: 1.3.8
credis: trunk
Please provide any additional information below.
1.3.8 corresponds to 'credis_keys function' CR_MULTIBULK and 1.3.8 corresponds
to 'cr_push fuction' CR_INT
Original issue reported on code.google.com by [email protected]
on 2 Nov 2010 at 12:25
What steps will reproduce the problem?
1.call credis_set
2.provide fh, key and value args to the function
What is the expected output? What do you see instead?
KEY should be set to VALUE
Instead it gets set to sizeof(VALUE) of the provided VALUE e.g. 5 in case of
KEY "hello".
What version of the product are you using? On what operating system?
credis 0.2.3 with redis 2.4.17 on RHEL 6.3 x86_64
Please provide any additional information below.
The attached test-client.c is compiled with the following line:
gcc -g -O2 -Wall -DPRINTDEBUG credis.c test-client.c -o test-client
Uppon executing the client, debug shows:
credis_connect() @ 768: Connected to Redis version: 2.4.17
cr_sendandreceive() @ 602: Sending message: len=21, data=SET abra 7
kadabra
cr_readln() @ 423: received 37 bytes: +OK
-ERR unknown command 'kadabra'
I'm guessing it's a parse string issue, since debug shows:
data=SET abra <val lenght> kadabra
Bbut i'm no C expert.
Checking the result with the redis_cli tool:
./redis-cli GET abra
"7"
Original issue reported on code.google.com by [email protected]
on 24 Sep 2012 at 7:18
Attachments:
hi romfelt,
there's an issue missing in your patch.
if you are using redis with security option (requirepass) you habe to
revalidate rhd->version after credis_auth otherwise rhd->version has no value.
redargs
kappe
Original issue reported on code.google.com by [email protected]
on 9 Sep 2010 at 8:36
What steps will reproduce the problem?
1. wget
2. tar xfv
3. make install
What is the expected output? What do you see instead?
I expected it to say install undefined or actually work
What version of the product are you using? On what operating system?
0.2.3, Ubuntu
Please provide any additional information below.
Please either complete the install routines or remove them. You are doing a
disservice otherwise.
Original issue reported on code.google.com by smlikens
on 9 Mar 2012 at 9:58
What steps will reproduce the problem?
1. Make a simple C program to get the type of a key using credis_type(rh,
"mykey")
What is the expected output? What do you see instead?
I expect to retrieve the type of the key that I'm querying. Instead, I get
EXC_BAD_ACCESS.
However, if I credis_get() a string key first, I am able to get the type
successfully.
What version of the product are you using? On what operating system?
credis 0.2.1
Mac OS X 10.6
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 11 May 2010 at 3:30
By the way, there's a fix needed for WIN32, because vsnprintf in windows
returns -1 when the buffer is too small, instead of the needed size. So in
cr_sendfandreceive you should replace
va_start(ap, format);
rc = vsnprintf(buf->data, buf->size, format, ap);
va_end(ap);
if (rc < 0)
return -1;
if (rc >= buf->size) {
DEBUG("truncated, get more memory and try again");
if (cr_moremem(buf, rc - buf->size + 1))
return CREDIS_ERR_NOMEM;
va_start(ap, format);
rc = vsnprintf(buf->data, buf->size, format, ap);
va_end(ap);
}
buf->len = rc;
with
va_start(ap, format);
rc = vsnprintf(buf->data, buf->size, format, ap);
va_end(ap);
if (rc < 0) {
#ifdef WIN32
rc = buf->size * 2;
#else
return -1;
#endif
}
while (rc >= buf->size) {
DEBUG("truncated, get more memory and try again");
if (cr_moremem(buf, rc - buf->size + 1))
return CREDIS_ERR_NOMEM;
va_start(ap, format);
rc = vsnprintf(buf->data, buf->size, format, ap);
va_end(ap);
if (rc < 0) {
#ifdef WIN32
rc = buf->size * 2;
#else
return -1;
#endif
}
}
buf->len = rc;
Regards,
Fernickk
Original issue reported on code.google.com by [email protected]
on 9 Sep 2010 at 8:43
just a patch with cr_sendvandreceive function, which could send command
base on a iovec array, and support binary key and value
int credis_getv(REDIS rhnd, const char *key, size_t key_len, char **val, size_t
*val_len);
int credis_setv(REDIS rhnd, const char *key, size_t key_len, const char *val,
size_t val_len);
int credis_existsv(REDIS rhnd, const char *key, size_t key_len);
Original issue reported on code.google.com by [email protected]
on 9 May 2010 at 4:48
Hi,
The Redis documentation for INCR, INCRBY, DECR, DECRBY states that Redis treats
the string as a 64-bit signed integer. Would it make sense for the
corresponding credis functions to return long rather than int?
Thanks,
Dean
Original issue reported on code.google.com by [email protected]
on 5 Sep 2010 at 7:21
Line 715 in credis_connect() calls gethostbyname() which is not reentrant.
gethostbyname_r() is reentrant. Also note that both of the gethostbyname()
calls are deprecated, replaced with getnameinfo().
Original issue reported on code.google.com by [email protected]
on 15 Sep 2010 at 12:00
it doesnt compile on freebsd..
just add these include on credis.c :
#include <netinet/in.h>
Original issue reported on code.google.com by [email protected]
on 29 Jul 2010 at 10:05
Adopt the new unified request protocol:
http://code.google.com/p/redis/wiki/ProtocolSpecification
Original issue reported on code.google.com by [email protected]
on 30 Sep 2010 at 7:32
credis-test.c will segfault if a connection to the redis server cannot be made.
There is no error handling, so this is confusing to the new user. Here is a
trivial patch to fix it:
--- credis-test.c.old 2010-05-19 16:50:09.000000000 -0400
+++ credis-test.c 2010-07-18 00:58:41.508511597 -0400
@@ -73,6 +73,10 @@
int main(int argc, char **argv) {
REDIS redis = credis_connect(NULL, 0, 10000);
+ if (redis == NULL) {
+ printf("Error connecting to Redis server. Please start server to run
tests.\n");
+ exit(1);
+ }
REDIS_INFO info;
char *val, **valv, lstr[50000];
const char *keyv[] = {"kalle", "adam", "unknown", "bertil", "none"};
Original issue reported on code.google.com by aaron.hamid
on 18 Jul 2010 at 5:01
When trying to modify a previously set value with hset the condition
if (rc == 0 && rhnd->reply.integer == 0)
rc = -1;
return rc;
Will return error.
This is a wrong behaviour in credis lib as long as i know.
Redis return values for hset specifies that
rhnd->reply.integer value is 1 for new set values, and 0 for modified values.
This patch avoid that hset return error when a value is modified by hset
function.
I have noticed same behaviour is present in zadd. Same patch can be applied to
that function too.
Maybe other functions are affected too.
Original issue reported on code.google.com by [email protected]
on 8 May 2012 at 7:18
Attachments:
A Request/Response server can be implemented so that it is able to process new
requests even if the client didn't already read the old responses. This way it
is possible to send multiple commands to the server without waiting for the
replies at all, and finally read the replies in a single step.
Redis supports pipelining since the very early days, so whatever version you
are running, you can use pipelining with Redis.
There should be something like the batch request, which remembers the order of
commands and places the results in accordance with this order.
Original issue reported on code.google.com by [email protected]
on 14 Jan 2012 at 3:55
Everyting was going fine while I was using redis-2.0.4
But when I replaced it with new redis-2.2.2 I've encountered a problem
When I use:
credis_hset(rhnd, "hash", "field", "value_of_field");
I see following in monitoring:
+1300875825.517306 "HSET" "hash" "field" "value_of_field" <-- in redis-2.0.4
1300875854.226830 "HSET" "hash" "field" "14" <-- in redis-2.2.2
Looks like HSET command is not a bulk command anymore.
I've attached a small patch which fixes HSET command but looks like there is
more commands with the same situation (see issue #37)
Original issue reported on code.google.com by [email protected]
on 23 Mar 2011 at 10:39
What steps will reproduce the problem?
1. credis_exists(redis,"non_existing"); -> -1
2. credis_exists(redis,"existing"); -> 0
What is the expected output? What do you see instead?
Redis return 0 for non existing and 1 for existing keys.
What version of the product are you using? On what operating system?
SVN r13
Please provide any additional information below.
It would be better to follow the Redis docs.
Original issue reported on code.google.com by [email protected]
on 9 Feb 2010 at 4:11
What steps will reproduce the problem?
1. credis_lrange(redis,"not_existing",0,-1,&elements);
What is the expected output? What do you see instead?
I would expect nil, null or 0 as return value
What version of the product are you using? On what operating system?
SVN rev. r13
Original issue reported on code.google.com by [email protected]
on 8 Feb 2010 at 10:34
some patch in attachment
so, add function credis_isconnect()
see patch file.
Original issue reported on code.google.com by akalend
on 10 Jun 2010 at 6:28
Attachments:
If you are using multiple servers (master + several slaves) sometimes some
of servers can be not available. Standard connect function on blocking
socket will take from 75 second to some minutes while attempt to create
connection with server which is unavailable. I suggest you use timed
connect (please see my patch in attach) with timeout from credis_connect
parameters. That will allow to report about connection problem within
user's provided timeout.
Regards, Dmitriy Lyfar.
Original issue reported on code.google.com by [email protected]
on 5 Jun 2010 at 12:05
Attachments:
What steps will reproduce the problem?
1. calling credis_del()
The redis protocoll defines delete as:
DEL key delete a key
So credis.c line 644:
int rc = cr_sendfandreceive(rhnd, CR_INT, "DELETE %s\r\n", key);
must be:
int rc = cr_sendfandreceive(rhnd, CR_INT, "DEL %s\r\n", key);
Original issue reported on code.google.com by [email protected]
on 8 Feb 2010 at 9:53
What steps will reproduce the problem?
1. credis_get(), credis_lrange(),...
SVN r13
Is this just a left over debug print or are there any problems with the
framework / connection?
Original issue reported on code.google.com by [email protected]
on 9 Feb 2010 at 1:09
What steps will reproduce the problem?
Checkout credis and build it
What is the expected output? What do you see instead?
Expected: built succesfully
Actual output:
cc -shared -Wl,-soname,libcredis.so -o libcredis.so credis.o
ld: unknown option: -soname
collect2: ld returned 1 exit status
gmake: *** [libcredis.so] Error 1
What version of the product are you using? On what operating system?
svn r8, OS X 10.6.2, gcc version 4.2.1
Please provide any additional information below.
"""
=== modified file 'Makefile'
--- Makefile 2009-12-03 21:30:48 +0000
+++ Makefile 2010-01-01 06:33:35 +0000
@@ -2,6 +2,13 @@
LDFLAGS =
CPPFLAGS =
+OS = $(shell uname -s)
+ifeq ($(OS),Darwin)
+ SHAREDLIB_LINK_OPTIONS=-dynamiclib -Wl,-install_name -Wl,
+else
+ SHAREDLIB_LINK_OPTIONS=-shared -Wl,-soname,
+endif
+
# targets to build with 'make all'
TARGETS = credis-test libcredis.a libcredis.so
@@ -14,7 +21,8 @@
$(AR) -cvq $@ $^
libcredis.so: credis.o
- $(CC) -shared -Wl,-soname,$@ -o $@ $^
+ $(CC) $(SHAREDLIB_LINK_OPTIONS)$@ -o $@ $^
+
credis.o: credis.c credis.h
$(CC) -c -fPIC $(CFLAGS) $(CPPFLAGS) -o $@ credis.c
"""
See also.
http://lists.ozlabs.org/pipermail/devicetree-discuss/2009-May/000818.html
http://www.finkproject.org/doc/porting/porting.en.html
Original issue reported on code.google.com by [email protected]
on 1 Jan 2010 at 6:34
There's realization of PERSIST, HMSET, HINCRBY and HVALS commands attached.
It works for redis-2.2.2 and probably works for the earlier versions.
Original issue reported on code.google.com by [email protected]
on 21 Apr 2011 at 7:55
Attachments:
In credis.h
/* returns -1 if the given member was already a member of the set */
int credis_sadd(REDIS rhnd, const char *key, const char *member);
/* returns -1 if the given member is not a member of the set */
int credis_srem(REDIS rhnd, const char *key, const char *member);
but when the given member was already a member of the set, credis_sadd
return 1, so as the credis_srem.
vsn:credis-0.2.1
Original issue reported on code.google.com by [email protected]
on 16 Apr 2010 at 7:50
rh = credis_connect("localhost", 0, 2000) results in segfault
Original issue reported on code.google.com by [email protected]
on 6 Oct 2010 at 8:07
What steps will reproduce the problem?
1. rc = credis_rpush(redis, "test", "123456789");
What is the expected output? What do you see instead?
expected output:
redis> lpop test
"123456789"
error output:
redis> lpop test
"9"
What version of the product are you using? On what operating system?
redis-2.2.2
solution:
static int cr_push(REDIS rhnd, int left, const char *key, const char *val)
{
int rc;
if (rhnd->version.major >= 2) {
// rc = cr_sendfandreceive(rhnd, CR_INT, "%s %s %zu\r\n%s\r\n",
// left==1?"LPUSH":"RPUSH", key, strlen(val), val);
// fixed :
rc = cr_sendfandreceive(rhnd, CR_INT, "*3\r\n$5\r\n%s\r\n$%zu\r\n%s\r\n$%zu\r\n%s\r\n",
left==1?"LPUSH":"RPUSH", strlen(key), key, strlen(val), val);
Original issue reported on code.google.com by [email protected]
on 5 Apr 2011 at 1:44
Add keyspace_hits and keyspace_misses to credis_info
They keep track of how many times a key is found (useful for caches)
Original issue reported on code.google.com by halkeye
on 9 Apr 2012 at 11:34
Attachments:
What steps will reproduce the problem?
1. Download source credis-0.2.3.tar.gz & untar
2. call `gmake`
What is the expected output? What do you see instead?
gcc don't known where u_int32_t is defined,
so <sys/types.h> must be included before <netinet/tcp.h>.
Patch in attachment.
What version of the product are you using? On what operating system?
credis-0.2.3 on FreeBSD 8.1 amd64
Original issue reported on code.google.com by [email protected]
on 21 Nov 2010 at 7:22
Attachments:
http://redis.io/commands/eval
Original issue reported on code.google.com by [email protected]
on 14 Jan 2012 at 4:01
It would be helpful if you could choose a license under which to release
credis, e.g. is it BSD licensed like redis itself?
Original issue reported on code.google.com by [email protected]
on 11 Mar 2010 at 6:07
What steps will reproduce the problem?
1. Checkout credis
2. Run "make"
What is the expected output? What do you see instead?
Expected: No warnings.
Actual result:
- "statement with no effect"
- "left-hand operand of comma expression has no effect"
What version of the product are you using? On what operating system?
svn rev8, OS X 10.6.2, gcc version 4.2.1
Please provide any additional information below.
A workarond for this would be:
=== modified file 'credis.c'
--- credis.c 2009-12-04 13:40:49 +0000
+++ credis.c 2010-01-01 06:16:35 +0000
@@ -92,7 +92,7 @@
/* add -DPRINTDEBUG to CPPFLAGS in Makefile for debug outputs */
#ifndef PRINTDEBUG
-#define DEBUG
+#define DEBUG(args...)
#else
#define DEBUG(args...) cr_debug(__FILE__, __FUNCTION__, __LINE__, ##args)
Original issue reported on code.google.com by [email protected]
on 1 Jan 2010 at 6:18
credis.cc:credis_lrem() - this request is malformed, and the request hangs
forever. The following is a correct implementation.
int credis_lrem(Redis rhnd, const char *key, int count, const char *val)
{
return cr_sendfandreceive(rhnd, CR_INT, "LREM %s %d %d\r\n%s\r\n",
key, count, (int)strlen(val), val);
}
Original issue reported on code.google.com by [email protected]
on 18 Mar 2010 at 12:48
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.