Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
5b9d3ac6
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,体验更适合开发者的 AI 搜索 >>
提交
5b9d3ac6
编写于
12月 18, 2019
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid changing setKey() API after #6679 fix.
上级
9d1baa07
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
21 addition
and
12 deletion
+21
-12
src/bitops.c
src/bitops.c
+1
-1
src/db.c
src/db.c
+10
-2
src/geo.c
src/geo.c
+1
-1
src/module.c
src/module.c
+3
-3
src/server.h
src/server.h
+2
-1
src/sort.c
src/sort.c
+1
-1
src/t_string.c
src/t_string.c
+3
-3
未找到文件。
src/bitops.c
浏览文件 @
5b9d3ac6
...
...
@@ -754,7 +754,7 @@ void bitopCommand(client *c) {
/* Store the computed value into the target key */
if
(
maxlen
)
{
o
=
createObject
(
OBJ_STRING
,
res
);
setKey
(
c
->
db
,
targetkey
,
o
,
0
);
setKey
(
c
->
db
,
targetkey
,
o
);
notifyKeyspaceEvent
(
NOTIFY_STRING
,
"set"
,
targetkey
,
c
->
db
->
id
);
decrRefCount
(
o
);
}
else
if
(
dbDelete
(
c
->
db
,
targetkey
))
{
...
...
src/db.c
浏览文件 @
5b9d3ac6
...
...
@@ -216,10 +216,11 @@ void dbOverwrite(redisDb *db, robj *key, robj *val) {
*
* 1) The ref count of the value object is incremented.
* 2) clients WATCHing for the destination key notified.
* 3) The expire time of the key is reset (the key is made persistent).
* 3) The expire time of the key is reset (the key is made persistent),
* unless 'keepttl' is true.
*
* All the new keys in the database should be created via this interface. */
void
s
etKey
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
,
int
keepttl
)
{
void
genericS
etKey
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
,
int
keepttl
)
{
if
(
lookupKeyWrite
(
db
,
key
)
==
NULL
)
{
dbAdd
(
db
,
key
,
val
);
}
else
{
...
...
@@ -230,6 +231,13 @@ void setKey(redisDb *db, robj *key, robj *val, int keepttl) {
signalModifiedKey
(
db
,
key
);
}
/* Common case for genericSetKey() where the TTL is not retained. */
void
setKey
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
)
{
genericSetKey
(
db
,
key
,
val
,
0
);
}
/* Return true if the specified key exists in the specified database.
* LRU/LFU info is not updated in any way. */
int
dbExists
(
redisDb
*
db
,
robj
*
key
)
{
return
dictFind
(
db
->
dict
,
key
->
ptr
)
!=
NULL
;
}
...
...
src/geo.c
浏览文件 @
5b9d3ac6
...
...
@@ -657,7 +657,7 @@ void georadiusGeneric(client *c, int flags) {
if
(
returned_items
)
{
zsetConvertToZiplistIfNeeded
(
zobj
,
maxelelen
);
setKey
(
c
->
db
,
storekey
,
zobj
,
0
);
setKey
(
c
->
db
,
storekey
,
zobj
);
decrRefCount
(
zobj
);
notifyKeyspaceEvent
(
NOTIFY_ZSET
,
"georadiusstore"
,
storekey
,
c
->
db
->
id
);
...
...
src/module.c
浏览文件 @
5b9d3ac6
...
...
@@ -2107,7 +2107,7 @@ RedisModuleString *RM_RandomKey(RedisModuleCtx *ctx) {
int
RM_StringSet
(
RedisModuleKey
*
key
,
RedisModuleString
*
str
)
{
if
(
!
(
key
->
mode
&
REDISMODULE_WRITE
)
||
key
->
iter
)
return
REDISMODULE_ERR
;
RM_DeleteKey
(
key
);
setKey
(
key
->
db
,
key
->
key
,
str
,
0
);
setKey
(
key
->
db
,
key
->
key
,
str
);
key
->
value
=
str
;
return
REDISMODULE_OK
;
}
...
...
@@ -2187,7 +2187,7 @@ int RM_StringTruncate(RedisModuleKey *key, size_t newlen) {
if
(
key
->
value
==
NULL
)
{
/* Empty key: create it with the new size. */
robj
*
o
=
createObject
(
OBJ_STRING
,
sdsnewlen
(
NULL
,
newlen
));
setKey
(
key
->
db
,
key
->
key
,
o
,
0
);
setKey
(
key
->
db
,
key
->
key
,
o
);
key
->
value
=
o
;
decrRefCount
(
o
);
}
else
{
...
...
@@ -3571,7 +3571,7 @@ int RM_ModuleTypeSetValue(RedisModuleKey *key, moduleType *mt, void *value) {
if
(
!
(
key
->
mode
&
REDISMODULE_WRITE
)
||
key
->
iter
)
return
REDISMODULE_ERR
;
RM_DeleteKey
(
key
);
robj
*
o
=
createModuleObject
(
mt
,
value
);
setKey
(
key
->
db
,
key
->
key
,
o
,
0
);
setKey
(
key
->
db
,
key
->
key
,
o
);
decrRefCount
(
o
);
key
->
value
=
o
;
return
REDISMODULE_OK
;
...
...
src/server.h
浏览文件 @
5b9d3ac6
...
...
@@ -2025,7 +2025,8 @@ int objectSetLRUOrLFU(robj *val, long long lfu_freq, long long lru_idle,
#define LOOKUP_NOTOUCH (1<<0)
void
dbAdd
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
);
void
dbOverwrite
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
);
void
setKey
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
,
int
keepttl
);
void
genericSetKey
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
,
int
keepttl
);
void
setKey
(
redisDb
*
db
,
robj
*
key
,
robj
*
val
);
int
dbExists
(
redisDb
*
db
,
robj
*
key
);
robj
*
dbRandomKey
(
redisDb
*
db
);
int
dbSyncDelete
(
redisDb
*
db
,
robj
*
key
);
...
...
src/sort.c
浏览文件 @
5b9d3ac6
...
...
@@ -570,7 +570,7 @@ void sortCommand(client *c) {
}
}
if
(
outputlen
)
{
setKey
(
c
->
db
,
storekey
,
sobj
,
0
);
setKey
(
c
->
db
,
storekey
,
sobj
);
notifyKeyspaceEvent
(
NOTIFY_LIST
,
"sortstore"
,
storekey
,
c
->
db
->
id
);
server
.
dirty
+=
outputlen
;
...
...
src/t_string.c
浏览文件 @
5b9d3ac6
...
...
@@ -84,7 +84,7 @@ void setGenericCommand(client *c, int flags, robj *key, robj *val, robj *expire,
addReply
(
c
,
abort_reply
?
abort_reply
:
shared
.
null
[
c
->
resp
]);
return
;
}
s
etKey
(
c
->
db
,
key
,
val
,
flags
&
OBJ_SET_KEEPTTL
);
genericS
etKey
(
c
->
db
,
key
,
val
,
flags
&
OBJ_SET_KEEPTTL
);
server
.
dirty
++
;
if
(
expire
)
setExpire
(
c
,
c
->
db
,
key
,
mstime
()
+
milliseconds
);
notifyKeyspaceEvent
(
NOTIFY_STRING
,
"set"
,
key
,
c
->
db
->
id
);
...
...
@@ -183,7 +183,7 @@ void getCommand(client *c) {
void
getsetCommand
(
client
*
c
)
{
if
(
getGenericCommand
(
c
)
==
C_ERR
)
return
;
c
->
argv
[
2
]
=
tryObjectEncoding
(
c
->
argv
[
2
]);
setKey
(
c
->
db
,
c
->
argv
[
1
],
c
->
argv
[
2
]
,
0
);
setKey
(
c
->
db
,
c
->
argv
[
1
],
c
->
argv
[
2
]);
notifyKeyspaceEvent
(
NOTIFY_STRING
,
"set"
,
c
->
argv
[
1
],
c
->
db
->
id
);
server
.
dirty
++
;
}
...
...
@@ -328,7 +328,7 @@ void msetGenericCommand(client *c, int nx) {
for
(
j
=
1
;
j
<
c
->
argc
;
j
+=
2
)
{
c
->
argv
[
j
+
1
]
=
tryObjectEncoding
(
c
->
argv
[
j
+
1
]);
setKey
(
c
->
db
,
c
->
argv
[
j
],
c
->
argv
[
j
+
1
]
,
0
);
setKey
(
c
->
db
,
c
->
argv
[
j
],
c
->
argv
[
j
+
1
]);
notifyKeyspaceEvent
(
NOTIFY_STRING
,
"set"
,
c
->
argv
[
j
],
c
->
db
->
id
);
}
server
.
dirty
+=
(
c
->
argc
-
1
)
/
2
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录