Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
OpenAtomFoundation
pika
提交
e2d43998
pika
项目概览
镜像
/
OpenAtomFoundation
/
pika
大约 1 年 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
pika
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e2d43998
编写于
3月 07, 2019
作者:
A
Axlgrep
提交者:
GitHub
3月 07, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
config set support new format compact-cron (#523)
上级
1889fe64
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
10 deletion
+26
-10
include/pika_server.h
include/pika_server.h
+1
-1
src/pika_admin.cc
src/pika_admin.cc
+25
-9
未找到文件。
include/pika_server.h
浏览文件 @
e2d43998
...
...
@@ -310,7 +310,7 @@ class PikaServer {
KeyScanInfo
()
:
start_time
(
0
),
s_start_time
(
"1970-01-01 08:00:00"
),
duration
(
-
1
),
duration
(
-
2
),
key_infos
({{
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
}}),
key_scaning_
(
false
)
{
}
...
...
src/pika_admin.cc
浏览文件 @
e2d43998
...
...
@@ -3,6 +3,7 @@
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#include <sys/time.h>
#include <algorithm>
#include "slash/include/slash_string.h"
#include "slash/include/rsync.h"
...
...
@@ -818,7 +819,9 @@ void InfoCmd::InfoKeyspace(std::string &info) {
std
::
stringstream
tmp_stream
;
tmp_stream
<<
"# Keyspace
\r\n
"
;
tmp_stream
<<
"# Time: "
<<
key_scan_info
.
s_start_time
<<
"
\r\n
"
;
tmp_stream
<<
"# Duration: "
<<
(
duration
==
-
1
?
"In Processing"
:
std
::
to_string
(
duration
)
+
"s"
)
<<
"
\r\n
"
;
if
(
duration
!=
-
2
)
{
tmp_stream
<<
"# Duration: "
<<
(
duration
==
-
1
?
"In Processing"
:
std
::
to_string
(
duration
)
+
"s"
)
<<
"
\r\n
"
;
}
tmp_stream
<<
"Strings: keys="
<<
key_infos
[
0
].
keys
<<
", expires="
<<
key_infos
[
0
].
expires
<<
", invaild_keys="
<<
key_infos
[
0
].
invaild_keys
<<
"
\r\n
"
;
tmp_stream
<<
"Hashes: keys="
<<
key_infos
[
1
].
keys
<<
", expires="
<<
key_infos
[
1
].
expires
<<
", invaild_keys="
<<
key_infos
[
1
].
invaild_keys
<<
"
\r\n
"
;
tmp_stream
<<
"Lists: keys="
<<
key_infos
[
2
].
keys
<<
", expires="
<<
key_infos
[
2
].
expires
<<
", invaild_keys="
<<
key_infos
[
2
].
invaild_keys
<<
"
\r\n
"
;
...
...
@@ -1471,18 +1474,31 @@ void ConfigCmd::ConfigSet(std::string& ret) {
}
else
if
(
set_item
==
"compact-cron"
)
{
bool
invalid
=
false
;
if
(
value
!=
""
)
{
std
::
string
::
size_type
len
=
value
.
length
();
std
::
string
::
size_type
colon
=
value
.
find
(
"-"
);
std
::
string
::
size_type
underline
=
value
.
find
(
"/"
);
bool
have_week
=
false
;
std
::
string
compact_cron
,
week_str
;
int
slash_num
=
count
(
value
.
begin
(),
value
.
end
(),
'/'
);
if
(
slash_num
==
2
)
{
have_week
=
true
;
std
::
string
::
size_type
first_slash
=
value
.
find
(
"/"
);
week_str
=
value
.
substr
(
0
,
first_slash
);
compact_cron
=
value
.
substr
(
first_slash
+
1
);
}
else
{
compact_cron
=
value
;
}
std
::
string
::
size_type
len
=
compact_cron
.
length
();
std
::
string
::
size_type
colon
=
compact_cron
.
find
(
"-"
);
std
::
string
::
size_type
underline
=
compact_cron
.
find
(
"/"
);
if
(
colon
==
std
::
string
::
npos
||
underline
==
std
::
string
::
npos
||
colon
>=
underline
||
colon
+
1
>=
len
||
colon
+
1
==
underline
||
underline
+
1
>=
len
)
{
invalid
=
true
;
invalid
=
true
;
}
else
{
int
start
=
std
::
atoi
(
value
.
substr
(
0
,
colon
).
c_str
());
int
end
=
std
::
atoi
(
value
.
substr
(
colon
+
1
,
underline
).
c_str
());
int
usage
=
std
::
atoi
(
value
.
substr
(
underline
+
1
).
c_str
());
if
(
start
<
0
||
start
>
23
||
end
<
0
||
end
>
23
||
usage
<
0
||
usage
>
100
)
{
int
week
=
std
::
atoi
(
week_str
.
c_str
());
int
start
=
std
::
atoi
(
compact_cron
.
substr
(
0
,
colon
).
c_str
());
int
end
=
std
::
atoi
(
compact_cron
.
substr
(
colon
+
1
,
underline
).
c_str
());
int
usage
=
std
::
atoi
(
compact_cron
.
substr
(
underline
+
1
).
c_str
());
if
((
have_week
&&
(
week
<
1
||
week
>
7
))
||
start
<
0
||
start
>
23
||
end
<
0
||
end
>
23
||
usage
<
0
||
usage
>
100
)
{
invalid
=
true
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录