修改缓存策略参数验证与处理逻辑

This commit is contained in:
zhangwei
2018-11-13 11:14:51 +08:00
parent 9ac9b35d07
commit 71803f7d3b
4 changed files with 77 additions and 30 deletions

View File

@@ -1351,7 +1351,7 @@ cache_whitelist=Cache Bypass
cache_key=Cache key
ignore_query_string=Ignore Query String in URL
include_cookie=Include Cookie Values
no_revalidate=Cache Revalidate
no_revalidate=No Revalidate
cache_dyn_url=Cache Dynamic Content
cache_cookied_cont=Cache Cookied Content
ignore_req_nocache=Ignore Request no-cache Headers
@@ -1362,3 +1362,6 @@ pinning_time=Cache Pinning Time
max_cache_size=Max Cache Size
inactive_time=Inactive Time
max_cache_obj_size=Max Cache Object Size
cache_time_error=Cache time can not exceed 24 hours(1440 minutes,86400 seconds).
cache_size_error=Cache size can not exceed 1024TB(1048576GB,1073741824MB).
ignore_qs_error=Ignore query string has invisible character or comma

View File

@@ -1341,7 +1341,7 @@ cache_whitelist=Cache Bypass
cache_key=Cache key
ignore_query_string=Ignore Query String in URL
include_cookie=Include Cookie Values
no_revalidate=Cache Revalidate
no_revalidate=No Revalidate
cache_dyn_url=Cache Dynamic Content
cache_cookied_cont=Cache Cookied Content
ignore_req_nocache=Ignore Request no-cache Headers
@@ -1351,4 +1351,7 @@ min_use=Minimum Use
pinning_time=Cache Pinning Time
max_cache_size=Max Cache Size
inactive_time=Inactive Time
max_cache_obj_size=Max Cache Object Size
max_cache_obj_size=Max Cache Object Size
cache_time_error=Cache time can not exceed 24 hours(1440 minutes,86400 seconds).
cache_size_error=Cache size can not exceed 1024TB(1048576GB,1073741824MB).
ignore_qs_error=Ignore query string has invisible character or comma

View File

@@ -1344,7 +1344,7 @@ cache_whitelist=\u7F13\u5B58\u767D\u540D\u5355
cache_key=\u7F13\u5B58\u7B97\u6CD5
ignore_query_string=\u5FFD\u7565URL\u4E2D\u7684\u67E5\u8BE2\u53C2\u6570
include_cookie=\u5305\u542B\u7684cookie\u4FE1\u606F
no_revalidate=\u7F13\u5B58\u91CD\u65B0\u9A8C\u8BC1
no_revalidate=\u4E0D\u91CD\u65B0\u9A8C\u8BC1
cache_dyn_url=\u7F13\u5B58\u52A8\u6001\u5185\u5BB9
cache_cookied_cont=\u7F13\u5B58Cookie\u5185\u5BB9
ignore_req_nocache=\u5FFD\u7565\u8BF7\u6C42\u5934\u57DF\u4E0D\u7F13\u5B58\u53C2\u6570
@@ -1354,4 +1354,7 @@ min_use=\u6700\u5C0F\u8BBF\u95EE\u6B21\u6570
pinning_time=\u7F13\u5B58\u65F6\u95F4
max_cache_size=\u6700\u5927\u7F13\u5B58\u5927\u5C0F
inactive_time=\u672A\u88AB\u8BF7\u6C42\u7684\u6587\u4EF6\u65F6\u95F4
max_cache_obj_size=\u6700\u5927\u7F13\u5B58\u5BF9\u8C61\u5927\u5C0F
max_cache_obj_size=\u6700\u5927\u7F13\u5B58\u5BF9\u8C61\u5927\u5C0F
cache_time_error=\u7F13\u5B58\u65F6\u95F4\u4E0D\u80FD\u8D85\u8FC7 24 \u5C0F\u65F6(1440\u5206\u949F,86400\u79D2).
cache_size_error=\u7F13\u5B58\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC71024TB(1048576GB,1073741824MB).
ignore_qs_error=\u5FFD\u7565\u7684\u67E5\u8BE2\u53C2\u6570\u4E2D\u5305\u542B\u4E0D\u53EF\u89C1\u5B57\u7B26\u6216\u8005\u9017\u53F7

View File

@@ -13,6 +13,35 @@
$(document)
.ready(
function() {
$("#ignore_qs").tagsInput({
width:$("#ignore_qs").find(".form-control").width(),
defaultText:'please input ignore query string in URL',
'delimiter':',',//特殊字符串分隔与表达式的多关键词
maxCount:0,
onAddTag:function(tag,size){
var reg = new RegExp(/\t|\r|\n|,/);
if (tag.match(reg)) {
$(this).parents(".col-md-6").next("div").html("<label class='error'><spring:message code='cache_param_character_error'/></label>");
}else{
$(this).parents(".col-md-6").next("div").html("");
}
},
onRemoveTag:function(tag,size){
$(this).parents(".col-md-6").next("div").html("");
}
});
$(".tagsinput").popover({
animation:true,
container:'body',
placement:'right',
html:true,
trigger:"hover",
title:"",
content:function(){
var content = $("#tagsinputTip").text();
return content;
}
});
//initCommIpVal();
/* $("#cancel").on("click", function() {
window.history.back();
@@ -71,67 +100,71 @@
var flag = true;
var subscribeId=0;
if($("#ignore_qs").parents(".col-md-6").next("div").html()!=''){
$("#ignore_qs").parents(".col-md-6").next("div").html("<label class='error'><spring:message code='cache_param_character_error'/></label>");
return;
}
if($("#pinning_time_unit").val()=='h'){
if(parseInt($("#pinning_time").val())>24){
alert($("#pinning_time").val());
$("div[for='pinning_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#pinning_time_unit").val()=='m'){
if(parseInt($("#pinning_time").val())>1440){
alert($("#pinning_time").val());
$("div[for='pinning_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#pinning_time_unit").val()=='s'){
if(parseInt($("#pinning_time").val())>86400){
alert($("#pinning_time").val());
$("div[for='pinning_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}
if($("#inactive_time_unit").val()=='h'){
if(parseInt($("#inactive_time").val())>24){
alert($("#inactive_time").val());
$("div[for='inactive_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#inactive_time_unit").val()=='m'){
if(parseInt($("#inactive_time").val())>1440){
alert($("#inactive_time").val());
$("div[for='inactive_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#inactive_time_unit").val()=='s'){
if(parseInt($("#inactive_time").val())>86400){
alert($("#inactive_time").val());
$("div[for='inactive_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}
if($("#max_cache_size_unit").val()=='t'){
if(parseInt($("#max_cache_size").val())>1024){
alert($("#max_cache_size").val());
$("div[for='max_cache_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_size_unit").val()=='g'){
if(parseInt($("#max_cache_size").val())>1048576){
alert($("#max_cache_size").val());
$("div[for='max_cache_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_size_unit").val()=='m'){
if(parseInt($("#max_cache_size").val())>1073741824){
alert($("#max_cache_size").val());
$("div[for='max_cache_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}
if($("#max_cache_obj_size_unit").val()=='t'){
if(parseInt($("#max_cache_obj_size").val())>1024){
alert($("#max_cache_obj_size").val());
$("div[for='max_cache_obj_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_obj_size_unit").val()=='g'){
if(parseInt($("#max_cache_obj_size").val())>1048576){
alert($("#max_cache_obj_size").val());
$("div[for='max_cache_obj_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_obj_size_unit").val()=='m'){
if(parseInt($("#max_cache_obj_size").val())>1073741824){
alert($("#max_cache_obj_size").val());
$("div[for='max_cache_obj_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}
@@ -357,19 +390,6 @@
</div>
</div>
<div class="row cacheAction">
<%-- <c:set var="propertyName" >ignore_qs</c:set> --%>
<div class="col-md-6 ignore_qs <c:if test='${empty _cfg.userRegion.cache_key.ignore_qs }'>hidden</c:if>">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="ignore_query_string" />
</label>
<div class="col-md-6">
<input id="ignore_qs" name="ignore_qs" class="form-control invisibleChar" type="text"
value="${fn:replace(fn:replace(_cfg.userRegion.cache_key.ignore_qs, '[',''),']','')}">
</div>
<div for="ignore_qs"></div>
</div>
</div>
<div class="col-md-6 cookie <c:if test='${empty _cfg.userRegion.cache_key.cookie }'>hidden</c:if>">
<div class="form-group">
<label class="control-label col-md-3">
@@ -381,6 +401,20 @@
<div for="cookie"></div>
</div>
</div>
<%-- <c:set var="propertyName" >ignore_qs</c:set> --%>
<div class="col-md-6 ignore_qs <c:if test='${empty _cfg.userRegion.cache_key.ignore_qs }'>hidden</c:if>">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="ignore_query_string" />
</label>
<div class="col-md-6">
<input id="ignore_qs" name="ignore_qs" class="form-control tags" type="text"
value="${fn:replace(fn:replace(_cfg.userRegion.cache_key.ignore_qs, '[',''),']','')}">
</div>
<div for="ignore_qs"></div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6">
@@ -525,6 +559,7 @@
</c:forEach>
</select>
</div>
<div for="pinning_time"></div>
<%-- <div class="input-group">
<input id="pinning_time_hour" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
@@ -561,6 +596,7 @@
</c:forEach>
</select>
</div>
<div for="max_cache_size"></div>
<%-- <div class="input-group">
<input id="max_cache_size_g" class="form-control input-small" type="text" />
<span class="input-group-btn">
@@ -589,6 +625,7 @@
</c:forEach>
</select>
</div>
<div for="inactive_time"></div>
<%-- <div class="input-group">
<input id="inactive_time_hour" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
@@ -627,6 +664,7 @@
</c:forEach>
</select>
</div>
<div for="max_cache_obj_size"></div>
</div>
</div>
</div>