????redis????????????????????????key-value??????????????????÷??????????????????????????y???????????????????м??????
????1.?????????
?????????redis?????????μ????????http://www.redis.io/
????????????make??ɡ?
????2.redis?????????
????????????????????redis????????src????????redis-server????????????????????????redis????????????????????????????????д?????????????????????????????
daemonize yes
pidfile /tmp/redis/var/redis.pid
port 6379
timeout 300
loglevel debug
logfile /tmp/redis/var/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dbfilename dump.rdb
dir /tmp/redis/var/
appendonly no
appendfsync always
#glueoutputbuf yes
#shareobjects no
#shareobjectspoolsize 1024
???????????redis.conf
??????????????./redis-server redis.conf???????redis???????????????????
????3.C/C++????redis
??????redis????????????deps?????????????hiredis????redis?????????????????????libhiredis.a?????????hiredis.h ?? libhiredis.a???????redis??????崠?????£?
????1?????????redisContext
????2)???redisContext???????
????3???????redisReply?л??????????
???????????£?
<pre code_snippet_id="151033" snippet_file_name="blog_20140110_2_9509153" name="code" class="cpp">redisContext *  c = redisConnect((char *)"192.168.150.135"??6379);
const char * pData = "this is a test";
<pre code_snippet_id="151033" snippet_file_name="blog_20140110_2_9509153" name="code" class="cpp">redisReply *reply1 = (redisReply *)redisCommand(c??"SET 100 %s"??pData);
<pre code_snippet_id="151033" snippet_file_name="blog_20140110_2_9509153" name="code" class="cpp"><pre code_snippet_id="151033" snippet_file_name="blog_20140110_2_9509153" name="code" class="cpp"><pre code_snippet_id="151033" snippet_file_name="blog_20140110_2_9509153" name="code" class="cpp">freeReplyObject(reply1);</pre>
<pre></pre>
<pre></pre>
<pre></pre>
<pre></pre>
<pre></pre>
<p></p>
<pre></pre>
<pre></pre>
<br>
<pre code_snippet_id="151033" snippet_file_name="blog_20140110_3_730653" name="code" class="cpp"><pre code_snippet_id="151033" snippet_file_name="blog_20140110_3_730653" name="code" class="cpp"><pre code_snippet_id="151033" snippet_file_name="blog_20140110_3_730653" name="code" class="cpp">redisReply *reply2 = (redisReply *)redisCommand(c??"GET 100");</pre>
<pre></pre>
<pre></pre>
printf("%s "??reply2->str);<br>
freeReplyObject(reply2);<br>
<pre></pre>
<pre></pre>
<pre></pre>