随笔分类 -  Redis

Redis - 发布/订阅模式
摘要:Redis 提供了一组命令可以让开发者实现 “发布/订阅” 模式。“发布/订阅” 可以实现进程间的消息传递,其原理是这样的: “发布/订阅” 模式中包含两种角色,分别是发布者和订阅者。订阅者可以订阅一个或若干个频道(channel),而发布者可以向指定的频道发送消息,所有订阅此频道的订阅者都会收到此 阅读全文
posted @ 2016-07-31 17:32 huey2672 阅读(678) 评论(0) 推荐(0)
Redis - 事务
摘要:Redis 中的事务是一组命令的集合。事务同命令一样都是 Redis 的最小执行单位,一个事务中的命令要么都执行,要么都不执行。事务的应用非常普遍,如银行转账过程中 A 给 B 汇款,首先系统从 A 的账户将钱划走,然后向 B 的账户增加相应的金额。这两个不走必须属于同一个事务,要么全都执行要么全都 阅读全文
posted @ 2016-07-10 20:17 huey2672 阅读(241) 评论(0) 推荐(0)
Redis - 排序
摘要:SORT 命令格式 SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination] 基本用法 SORT 命令可以对列表类型、集合类型和有 阅读全文
posted @ 2016-07-09 00:37 huey2672 阅读(886) 评论(0) 推荐(0)
Redis - HyperLogLogs
摘要:A HyperLogLog is a probabilistic data structure used in order to count unique things (technically this is referred to estimating the cardinality of a 阅读全文
posted @ 2016-07-07 11:09 huey2672 阅读(633) 评论(0) 推荐(0)
Jedis - hello world
摘要:Maven Dependency: redis.clients jedis 2.7.2 jar compileUse:Jedis jedis = new Jedis("127.0.0.1", 6379);jedis.set("foo", "bar");String va... 阅读全文
posted @ 2015-09-29 14:48 huey2672 阅读(222) 评论(0) 推荐(0)
Redis 命令 - Server
摘要:BGREWRITEAOFAsynchronously rewrite the append-only fileBGSAVEAsynchronously save the dataset to diskCLIENT KILL [ip:port] [ID client-id] [TYPE normal|... 阅读全文
posted @ 2015-09-26 13:48 huey2672 阅读(459) 评论(0) 推荐(0)
Redis 命令 - Connection
摘要:AUTH passwordAuthenticate to the serverMore:http://redis.io/commands/auth,http://www.redis.cn/commands/auth.htmlECHO messageEcho the given string127.0... 阅读全文
posted @ 2015-09-26 11:40 huey2672 阅读(453) 评论(0) 推荐(0)
Redis 命令 - Transactions
摘要:DISCARD Discard all commands issued after MULTI More: http://redis.io/commands/discard, http://www.redis.cn/commands/discard.html EXEC Execute all com 阅读全文
posted @ 2015-09-25 14:50 huey2672 阅读(278) 评论(0) 推荐(0)
Redis 命令 - Sorted Sets
摘要:ZADD key score member [score member ...]Add one or more members to a sorted set, or update its score if it already exists127.0.0.1:6379> ZADD foo 1 on... 阅读全文
posted @ 2015-09-25 14:23 huey2672 阅读(454) 评论(0) 推荐(0)
Redis 命令 - Sets
摘要:SADD key member [member ...]Add one or more members to a set127.0.0.1:6379> SADD foo hello(integer) 1127.0.0.1:6379> SADD foo world(integer) 1127.0.0.... 阅读全文
posted @ 2015-09-25 09:56 huey2672 阅读(411) 评论(0) 推荐(0)
Redis 命令 - Hashs
摘要:HDEL key field [field ...]Delete one or more hash fields127.0.0.1:6379> HSET book.1 title helloworld(integer) 0127.0.0.1:6379> HEXISTS book.1 title(in... 阅读全文
posted @ 2015-09-24 21:00 huey2672 阅读(343) 评论(0) 推荐(0)
Redis 命令 - Lists
摘要:BLPOP key [key ...] timeoutRemove and get the first element in a list, or block until one is availableMore:http://redis.io/commands/blpop,http://www.r... 阅读全文
posted @ 2015-09-24 20:44 huey2672 阅读(339) 评论(0) 推荐(0)
Redis 命令 - Strings
摘要:APPEND key value Available since 2.0.0, Time complexity: O(1). Append a value to a key More: http://redis.io/commands/append, http://www.redis.cn/comm 阅读全文
posted @ 2015-09-24 20:07 huey2672 阅读(331) 评论(0) 推荐(0)
Redis 命令 - Keys
摘要:DEL key [key ...] Delete a key DUMP key Return a serialized version of the value stored at the specified key. EXISTS key Determine if a key exists EXP 阅读全文
posted @ 2015-09-24 15:25 huey2672 阅读(275) 评论(0) 推荐(0)
Redis - 环境的安装配置
摘要:Redis 下载安装步骤:下载 redis 源码:[huey@huey-K42JE ~]$wget http://download.redis.io/releases/redis-x.y.z.tar.gz解压文件:[huey@huey-K42JE ~]$tar xzf redis-x.y.z.tar... 阅读全文
posted @ 2015-09-24 14:29 huey2672 阅读(298) 评论(0) 推荐(0)