Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
3ba37089
R
redis
项目概览
xindoo
/
redis
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3ba37089
编写于
5月 21, 2009
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
command postprocessing implemented into RubyRedis
上级
3f32f1f6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
5 deletion
+35
-5
TODO
TODO
+0
-1
client-libraries/ruby_2/rubyredis.rb
client-libraries/ruby_2/rubyredis.rb
+34
-2
redis.c
redis.c
+1
-2
未找到文件。
TODO
浏览文件 @
3ba37089
BEFORE REDIS 1.0.0-rc1
BEFORE REDIS 1.0.0-rc1
* S*STORE should allow as dest key one of the source keys
* Warning if using default config, with hint about 'redis-server redis.conf'
* Warning if using default config, with hint about 'redis-server redis.conf'
* Add number of keys for every DB in INFO
* Add number of keys for every DB in INFO
* maxmemory support
* maxmemory support
...
...
client-libraries/ruby_2/rubyredis.rb
浏览文件 @
3ba37089
...
@@ -14,6 +14,35 @@ class RedisClient
...
@@ -14,6 +14,35 @@ class RedisClient
"echo"
=>
true
,
"getset"
=>
true
,
"smove"
=>
true
"echo"
=>
true
,
"getset"
=>
true
,
"smove"
=>
true
}
}
ConvertToBool
=
lambda
{
|
r
|
r
==
0
?
false
:
r
}
ReplyProcessor
=
{
"exists"
=>
ConvertToBool
,
"sismember"
=>
ConvertToBool
,
"sadd"
=>
ConvertToBool
,
"srem"
=>
ConvertToBool
,
"smove"
=>
ConvertToBool
,
"move"
=>
ConvertToBool
,
"setnx"
=>
ConvertToBool
,
"del"
=>
ConvertToBool
,
"renamenx"
=>
ConvertToBool
,
"expire"
=>
ConvertToBool
,
"keys"
=>
lambda
{
|
r
|
r
.
split
(
" "
)},
"info"
=>
lambda
{
|
r
|
info
=
{}
r
.
each_line
{
|
kv
|
k
,
v
=
kv
.
split
(
':'
,
2
)
k
,
v
=
k
.
chomp
,
v
=
v
.
chomp
info
[
k
.
to_sym
]
=
v
}
info
}
}
def
convert_to_bool
(
r
)
r
==
0
?
false
:
r
end
def
initialize
(
opts
=
{})
def
initialize
(
opts
=
{})
opts
=
{
:host
=>
'localhost'
,
:port
=>
'6379'
,
:db
=>
0
}.
merge
(
opts
)
opts
=
{
:host
=>
'localhost'
,
:port
=>
'6379'
,
:db
=>
0
}.
merge
(
opts
)
@host
=
opts
[
:host
]
@host
=
opts
[
:host
]
...
@@ -52,12 +81,15 @@ class RedisClient
...
@@ -52,12 +81,15 @@ class RedisClient
bulk
=
nil
bulk
=
nil
argv
[
0
]
=
argv
[
0
].
to_s
.
downcase
argv
[
0
]
=
argv
[
0
].
to_s
.
downcase
if
BulkCommands
[
argv
[
0
]]
if
BulkCommands
[
argv
[
0
]]
bulk
=
argv
[
-
1
]
bulk
=
argv
[
-
1
]
.
to_s
argv
[
-
1
]
=
bulk
.
length
argv
[
-
1
]
=
bulk
.
length
end
end
@sock
.
write
(
argv
.
join
(
" "
)
+
"
\r\n
"
)
@sock
.
write
(
argv
.
join
(
" "
)
+
"
\r\n
"
)
@sock
.
write
(
bulk
+
"
\r\n
"
)
if
bulk
@sock
.
write
(
bulk
+
"
\r\n
"
)
if
bulk
read_reply
# Post process the reply if needed
processor
=
ReplyProcessor
[
argv
[
0
]]
processor
?
processor
.
call
(
read_reply
)
:
read_reply
end
end
def
select
(
*
args
)
def
select
(
*
args
)
...
...
redis.c
浏览文件 @
3ba37089
...
@@ -2973,7 +2973,7 @@ static void sinterGenericCommand(redisClient *c, robj **setskeys, int setsnum, r
...
@@ -2973,7 +2973,7 @@ static void sinterGenericCommand(redisClient *c, robj **setskeys, int setsnum, r
robj
*
lenobj
=
NULL
,
*
dstset
=
NULL
;
robj
*
lenobj
=
NULL
,
*
dstset
=
NULL
;
int
j
,
cardinality
=
0
;
int
j
,
cardinality
=
0
;
if
(
!
dv
)
oom
(
"sinterCommand"
);
if
(
!
dv
)
oom
(
"sinter
Generic
Command"
);
for
(
j
=
0
;
j
<
setsnum
;
j
++
)
{
for
(
j
=
0
;
j
<
setsnum
;
j
++
)
{
robj
*
setobj
;
robj
*
setobj
;
...
@@ -3151,7 +3151,6 @@ static void sunionDiffGenericCommand(redisClient *c, robj **setskeys, int setsnu
...
@@ -3151,7 +3151,6 @@ static void sunionDiffGenericCommand(redisClient *c, robj **setskeys, int setsnu
deleteKey
(
c
->
db
,
dstkey
);
deleteKey
(
c
->
db
,
dstkey
);
dictAdd
(
c
->
db
->
dict
,
dstkey
,
dstset
);
dictAdd
(
c
->
db
->
dict
,
dstkey
,
dstset
);
incrRefCount
(
dstkey
);
incrRefCount
(
dstkey
);
server
.
dirty
++
;
}
}
/* Cleanup */
/* Cleanup */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录