缓存策略参数单位修改

This commit is contained in:
zhangwei
2018-11-12 20:40:33 +08:00
parent 1a22ce1286
commit 0dd6860a14
6 changed files with 144 additions and 52 deletions

View File

@@ -81,18 +81,18 @@ public class CachePolicyController extends BaseController{
if(cfg.getAction().equals(128)){//不为白名单时保存自定义域
cfg.setUserRegion(null);
}else{
String ignore_qs = request.getParameter("ignore_qs").trim();
String hdrs = request.getParameter("hdrs").trim();
String cookie = request.getParameter("cookie").trim();
String ignore_qs = request.getParameter("ignore_qs");
String hdrs = request.getParameter("hdrs");
String cookie = request.getParameter("cookie");
Map<String,Object> map = new HashMap();
if(!StringUtil.isBlank(ignore_qs)){
map.put("ignore_qs", ignore_qs.split(","));
}
if(!StringUtil.isBlank(hdrs)){
map.put("hdrs",hdrs);
map.put("hdrs",hdrs.trim());
}
if(!StringUtil.isBlank(cookie)){
map.put("cookie", cookie);
map.put("cookie", cookie.trim());
}
cfg.getUserRegion().put("cache_key", map);
if(!StringUtil.isEmpty(cfg.getUserRegion().get("min_use"))){

View File

@@ -1350,7 +1350,7 @@ cache=Cache
cache_whitelist=Cache Bypass
cache_key=Cache key
ignore_query_string=Ignore Query String in URL
include_cookie=Include HTTP Header Fields
include_cookie=Include Cookie Values
no_revalidate=Cache Revalidate
cache_dyn_url=Cache Dynamic Content
cache_cookied_cont=Cache Cookied Content
@@ -1361,3 +1361,4 @@ 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

View File

@@ -1340,7 +1340,7 @@ cache=Cache
cache_whitelist=Cache Bypass
cache_key=Cache key
ignore_query_string=Ignore Query String in URL
include_cookie=Include HTTP Header Fields
include_cookie=Include Cookie Values
no_revalidate=Cache Revalidate
cache_dyn_url=Cache Dynamic Content
cache_cookied_cont=Cache Cookied Content
@@ -1350,4 +1350,5 @@ force_caching=Forcing Object Caching
min_use=Minimum Use
pinning_time=Cache Pinning Time
max_cache_size=Max Cache Size
inactive_time=Inactive Time
inactive_time=Inactive Time
max_cache_obj_size=Max Cache Object Size

View File

@@ -1343,7 +1343,7 @@ cache=\u7F13\u5B58
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\u62ECHTTP\u5934\u57DF\u5B57\u6BB5
include_cookie=\u5305\u542B\u7684cookie\u4FE1\u606F
no_revalidate=\u7F13\u5B58\u91CD\u65B0\u9A8C\u8BC1
cache_dyn_url=\u7F13\u5B58\u52A8\u6001\u5185\u5BB9
cache_cookied_cont=\u7F13\u5B58Cookie\u5185\u5BB9
@@ -1353,4 +1353,5 @@ force_caching=\u5F3A\u5236\u7F13\u5B58
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
inactive_time=\u672A\u88AB\u8BF7\u6C42\u7684\u6587\u4EF6\u65F6\u95F4
max_cache_obj_size=\u6700\u5927\u7F13\u5B58\u5BF9\u8C61\u5927\u5C0F

View File

@@ -21,7 +21,7 @@
$("#serviceId").val($(this).attr("serviceId"));
$("#protocolId").val($(this).attr("protocolId"));
if($(this).val()==128){
$("#doLog").val($(".action:checked").attr("0"));
$("#doLog").val(0);
$("input:radio[name='doLog']").attr("disabled",true);
$(".cacheAction").hide();
}else{
@@ -70,38 +70,71 @@
submitHandler : function(form) {
var flag = true;
var subscribeId=0;
var pinning_time=0;
var max_cache_size=0;
var inactive_time=0
if($("#pinning_time_hour").val()!=''){
pinning_time =pinning_time+parseInt($("#pinning_time_hour").val())*3600;
if($("#pinning_time_unit").val()=='h'){
if(parseInt($("#pinning_time").val())>24){
alert($("#pinning_time").val());
return ;
}
}else if($("#pinning_time_unit").val()=='m'){
if(parseInt($("#pinning_time").val())>1440){
alert($("#pinning_time").val());
return ;
}
}else if($("#pinning_time_unit").val()=='s'){
if(parseInt($("#pinning_time").val())>86400){
alert($("#pinning_time").val());
return ;
}
}
if($("#pinning_time_min").val()!=''){
pinning_time =pinning_time+parseInt($("#pinning_time_min").val())*60;
if($("#inactive_time_unit").val()=='h'){
if(parseInt($("#inactive_time").val())>24){
alert($("#inactive_time").val());
return ;
}
}else if($("#inactive_time_unit").val()=='m'){
if(parseInt($("#inactive_time").val())>1440){
alert($("#inactive_time").val());
return ;
}
}else if($("#inactive_time_unit").val()=='s'){
if(parseInt($("#inactive_time").val())>86400){
alert($("#inactive_time").val());
return ;
}
}
if($("#pinning_time_sec").val()!=''){
pinning_time =pinning_time+parseInt($("#pinning_time_sec").val());
if($("#max_cache_size_unit").val()=='t'){
if(parseInt($("#max_cache_size").val())>1024){
alert($("#max_cache_size").val());
return ;
}
}else if($("#max_cache_size_unit").val()=='g'){
if(parseInt($("#max_cache_size").val())>1048576){
alert($("#max_cache_size").val());
return ;
}
}else if($("#max_cache_size_unit").val()=='m'){
if(parseInt($("#max_cache_size").val())>1073741824){
alert($("#max_cache_size").val());
return ;
}
}
if($("#inactive_time_hour").val()!=''){
inactive_time =inactive_time+parseInt($("#inactive_time_hour").val())*3600;
if($("#max_cache_obj_size_unit").val()=='t'){
if(parseInt($("#max_cache_obj_size").val())>1024){
alert($("#max_cache_obj_size").val());
return ;
}
}else if($("#max_cache_obj_size_unit").val()=='g'){
if(parseInt($("#max_cache_obj_size").val())>1048576){
alert($("#max_cache_obj_size").val());
return ;
}
}else if($("#max_cache_obj_size_unit").val()=='m'){
if(parseInt($("#max_cache_obj_size").val())>1073741824){
alert($("#max_cache_obj_size").val());
return ;
}
}
if($("#inactive_time_min").val()!=''){
inactive_time =inactive_time+parseInt($("#inactive_time_min").val())*60;
}
if($("#inactive_time_sec").val()!=''){
inactive_time =inactive_time+parseInt($("#inactive_time_sec").val());
}
if($("#max_cache_size_g").val()!=''){
max_cache_size =max_cache_size+parseInt($("#max_cache_size_g").val())*1024;
}
if($("#max_cache_size_m").val()!=''){
max_cache_size =max_cache_size+parseInt($("#max_cache_size_m").val());
}
alert(max_cache_size);
$("#pinning_time").val(pinning_time+"s");
$("#max_cache_size").val(max_cache_size+"m");
$("#inactive_time").val(inactive_time+"s");
//存在隐藏的subscribeId不算进域配置
if($(".boxSolid.hidden").hasClass("subscribeId")){
subscribeId=1;
@@ -158,6 +191,10 @@
$(this).remove();
});
$("input[name$='exprType']").attr("disabled",false);
$("#pinning_time").val($("#pinning_time").val()+$("#pinning_time_unit").val());
$("#inactive_time").val($("#inactive_time").val()+$("#inactive_time_unit").val());
$("#max_cache_size").val($("#max_cache_size").val()+$("#max_cache_size_unit").val());
$("#max_cache_obj_size").val($("#max_cache_obj_size").val()+$("#max_cache_obj_size_unit").val());
loading('onloading...');
form.submit();
}else{
@@ -327,7 +364,8 @@
<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, '[',''),']','')}">
<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>
@@ -354,7 +392,10 @@
<select name="userRegion['no_revalidate']" id="no_revalidate"
class="selectpicker show-tick form-control">
<c:forEach items="${fns:getDictList('CACHE_NO_REVALIDATE')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${_cfg.userRegion.no_revalidate eq dict.itemCode || (empty _cfg.userRegion.no_revalidate && dict.itemCode eq 1)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
<option value="${dict.itemCode}"
<c:if test="${_cfg.userRegion.no_revalidate eq dict.itemCode
|| (empty _cfg.userRegion.no_revalidate && dict.itemCode eq 0)}">selected</c:if>>
<spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
<%-- <input id="revalidate" name="userRegion['no_revalidate']" class="form-control" type="text" value="${_cfg.userRegion.no_revalidate}"> --%>
@@ -474,8 +515,17 @@
<spring:message code="pinning_time" />
</label>
<div class="col-md-6">
<input type="hidden" id="pinning_time" name="userRegion['pinning_time']" value="${_cfg.userRegion.pinning_time }" />
<div class="input-group">
<input type="input" id="pinning_time" class="form-control input-small" name="userRegion['pinning_time']"
value="${fn:substring(_cfg.userRegion.pinning_time,0, fn:length(_cfg.userRegion.pinning_time)-1) }" />
<select id="pinning_time_unit"
class="selectpicker show-tick form-control input-small">
<c:forEach items="${fns:getDictList('CACHE_TIME_UNIT')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${fns:endsWith(_cfg.userRegion.pinning_time,dict.itemCode)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
<%-- <div class="input-group">
<input id="pinning_time_hour" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
<button class="btn" type="button">h</button>
@@ -488,7 +538,7 @@
<span class="input-group-btn">
<button class="btn" type="button">s</button>
</span>
</div>
</div> --%>
</div>
</div>
@@ -501,8 +551,17 @@
<spring:message code="max_cache_size" />
</label>
<div class="col-md-6">
<input type="hidden" id="max_cache_size" name="userRegion['max_cache_size']" value="${_cfg.userRegion.max_cache_size }" />
<div class="input-group">
<input type="input" id="max_cache_size" class="form-control input-small" name="userRegion['max_cache_size']"
value="${fn:substring(_cfg.userRegion.max_cache_size,0, fn:length(_cfg.userRegion.max_cache_size)-1) }" />
<select id="max_cache_size_unit"
class="selectpicker show-tick form-control input-small">
<c:forEach items="${fns:getDictList('CACHE_SIZE_UNIT')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${fns:endsWith(_cfg.userRegion.max_cache_size,dict.itemCode)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
<%-- <div class="input-group">
<input id="max_cache_size_g" class="form-control input-small" type="text" />
<span class="input-group-btn">
<button class="btn" type="button">G</button>
@@ -510,12 +569,7 @@
<input id="max_cache_size_m" class="form-control input-small" type="text" value="${fn:replace(_cfg.userRegion.max_cache_size, 'm', '')}" /> <span class="input-group-btn">
<button class="btn" type="button">M</button>
</span>
<!-- <input id="max_cache_size_k" class="form-control input-xsmall" type="text" >
<span class="input-group-btn">
<button class="btn" type="button">K</button>
</span> -->
</div>
<%-- <input id="max_cache_size" name="userRegion['max_cache_size']" class="form-control" type="text" value="${_cfg.userRegion.max_cache_size}"> --%>
</div> --%>
</div>
</div>
</div>
@@ -525,8 +579,17 @@
<spring:message code="inactive_time" />
</label>
<div class="col-md-6">
<input type="hidden" id="inactive_time" name="userRegion['inactive_time']" value="${_cfg.userRegion.inactive_time }" />
<div class="input-group">
<input type="input" id="inactive_time" class="form-control input-small" name="userRegion['inactive_time']"
value="${fn:substring(_cfg.userRegion.inactive_time,0, fn:length(_cfg.userRegion.inactive_time)-1) }" />
<select id="inactive_time_unit"
class="selectpicker show-tick form-control input-small">
<c:forEach items="${fns:getDictList('CACHE_TIME_UNIT')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${fns:endsWith(_cfg.userRegion.inactive_time,dict.itemCode)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
<%-- <div class="input-group">
<input id="inactive_time_hour" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
<button class="btn" type="button">h</button>
@@ -539,13 +602,35 @@
<span class="input-group-btn">
<button class="btn" type="button">s</button>
</span>
</div>
</div> --%>
<%-- <input id="inactive_time" name="userRegion['inactive_time']" class="form-control" type="text" value="${_cfg.userRegion.inactive_time}"> --%>
</div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="max_cache_obj_size" />
</label>
<div class="col-md-6">
<div class="input-group">
<input type="input" id="max_cache_obj_size" class="form-control input-small"
name="userRegion['max_cache_obj_size']"
value="${fn:substring(_cfg.userRegion.max_cache_obj_size, 0,fn:length(_cfg.userRegion.max_cache_obj_size)-1) }" />
<select id="max_cache_obj_size_unit"
class="selectpicker show-tick form-control input-small">
<c:forEach items="${fns:getDictList('CACHE_SIZE_UNIT')}" var="dict">
<option value="${dict.itemCode}" <c:if test="${fns:endsWith(_cfg.userRegion.max_cache_obj_size,dict.itemCode)}">selected</c:if>><spring:message code="${dict.itemValue}"/></option>
</c:forEach>
</select>
</div>
</div>
</div>
</div>
</div>
<br>
<c:set var="strCfgIndex" value="0"></c:set>
<c:forEach items="${regionList}" var="region" varStatus="status">

View File

@@ -356,6 +356,7 @@
<th><spring:message code="pinning_time"/></th>
<th><spring:message code="max_cache_size"/></th>
<th><spring:message code="inactive_time"/></th>
<th><spring:message code="max_cache_obj_size"/></th>
<th class="sort-column a.is_audit"><spring:message code="is_audit"/></th>
<th><spring:message code="whether_area_block"/></th>
<th><spring:message code="letter"/></th>
@@ -448,6 +449,9 @@
<td>
${indexCfg.userRegion.inactive_time}
</td>
<td>
${indexCfg.userRegion.max_cache_obj_size}
</td>
<td>
<c:choose>
<c:when test="${indexCfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>