Authored by qinchao

redis清除缓存

... ... @@ -82,11 +82,8 @@
<div class="form-inline" role="form" style="margin: 12px; ;">
<div class="input-group">
<span class="input-group-addon">prefix:</span>
<select id="prefixInput" class="form-control">
<option value="yh:users:userInfo">yh:users:userInfo</option>
<option value="yh:uic:userinfo:yohouid">yh:uic:userinfo:yohouid</option>
<%--<option value="localhost:3306">Test</option>--%>
</select>
<input id="prefixInput" class="form-control">
</input>
</div>
<button id="btnSearch" class="btn btn-danger" style="margin-left: 10px" onclick="btnClear()">
清除缓存
... ... @@ -108,6 +105,16 @@
var _PAGE_REDIS_SOURCE="";
function btnClear() {
var pre=$.trim($("#prefixInput").val());
if(pre==null||pre.length<=0){
localAlert('提示', '请求参数prefix不允许为空!');
return ;
}
if(!checkRate(pre.substr(0,1))){
localAlert('提示', '请求参数prefix必须以数字或字母开头!');
return ;
}
var dialog = $("<div>").appendTo($("body"));
dialog.dialog({
title: "清除确定",
... ... @@ -124,7 +131,7 @@
className: "btn-success",
onclick: function () {
$(dialog).dialog("hide");
goClear();
goClear(pre);
}
}]
});
... ... @@ -132,10 +139,10 @@
}
function goClear(){
function goClear(pre){
var frontParam={};
frontParam.dataSourceInfo=_PAGE_REDIS_SOURCE;
frontParam.keyPrefix=$.trim($("#prefixInput option:selected").val());
frontParam.keyPrefix=pre;
$.post({
url: contextPath + "redisClear/clear",
... ... @@ -155,6 +162,17 @@
});
}
function checkRate(nubmer)
{
var re = /^[0-9a-zA-Z]*$/g; //判断字符串是否为数字和字母组合 //判断正整数 /^[1-9]+[0-9]*]*$/
if (!re.test(nubmer))
{
return false;
}else{
return true;
}
}
$(document).ready(function () {
//查询redis配置信息
... ...