欢迎投稿

今日深度:

Redis,

Redis,


Redis:高性能key-value存储,持久化,支持string,list等多种数据类型,支持N多命令,相当灵活。

官网:http://redis.io/

中文:http://www.redis.cn/

 

Demo:

windows版(非官方,开发调试用,Redis本身不支持Windows)

https://github.com/dmajkic/redis/

prebuilt binaries https://github.com/dmajkic/redis/downloads

 

下载解压后的文件:

libhiredis.dll
redis-benchmark.exe
redis-check-aof.exe
redis-check-dump.exe
redis-cli.exe
redis-server.exe
redis.conf

redis-server.exe是Redis服务程序,命令行运行后启动服务端
[2624] 28 May 17:19:30 * Server started, Redis version 2.4.2
[2624] 28 May 17:19:30 # Open data file dump.rdb: No such file or directory
[2624] 28 May 17:19:30 * The server is now ready to accept connections on port 6379

 

redis-cli.exe是一个客户端程序,命令行下运行,简单的一个Set/Get

redis 127.0.0.1:6379> set mykey "this is a value"
OK
redis 127.0.0.1:6379> get mykey
"this is a value"
redis 127.0.0.1:6379>

 

C#客户端

有好几个,本文使用ServiceStack.Redis

https://github.com/ServiceStack/ServiceStack.Redis

 

常用方法

复制代码             //初始化连接
            RedisClient(string host, int port);
            //set key value
            bool Set<T>(string key, T value);
            //get value
            byte[] Get(string key);
            //set list
            AddItemToList(string listId, string value);
            //get list
            List<string> GetAllItemsFromList(string listId);
            //set object<T>
            bool Set<T>(string key, T value);
            //get object<T>
            T Get<T>(string key); 复制代码

 

链接:

Redis数据结构

Redis几个误区

中文命令参考

优化

本文转自chy710博客园博客,原文链接:http://www.cnblogs.com/chy710/archive/2012/05/28/redis.html,如需转载请自行联系原作者

www.htsjk.Com true http://www.htsjk.com/redis/43480.html NewsArticle Redis, Redis:高性能key-value存储,持久化,支持string,list等多种数据类型,支持N多命令,相当灵活。 官网:http://redis.io/ 中文:http://www.redis.cn/   Demo: windows版(非官方,开发调试用,Re...
评论暂时关闭