字典管理添加缓存读取

This commit is contained in:
RuoYi
2020-03-18 15:03:52 +08:00
parent f8491c36e2
commit 05b5b314ee
12 changed files with 233 additions and 78 deletions

View File

@ -125,14 +125,20 @@ public class SysDictTypeController extends BaseController
@ResponseBody
public AjaxResult remove(String ids)
{
try
{
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
}
catch (Exception e)
{
return error(e.getMessage());
}
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
}
/**
* 清空缓存
*/
@RequiresPermissions("system:dict:remove")
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@GetMapping("/clearCache")
@ResponseBody
public AjaxResult clearCache()
{
dictTypeService.clearCache();
return success();
}
/**

View File

@ -41,7 +41,15 @@
timeToIdleSeconds="0"
statistics="true">
</cache>
<!-- 系统缓存 -->
<cache name="sys-cache"
maxEntriesLocalHeap="1000"
eternal="true"
overflowToDisk="true"
statistics="true">
</cache>
<!-- 系统参数缓存 -->
<cache name="sys-config"
maxEntriesLocalHeap="1000"
@ -50,6 +58,14 @@
statistics="true">
</cache>
<!-- 系统字典缓存 -->
<cache name="sys-dict"
maxEntriesLocalHeap="1000"
eternal="true"
overflowToDisk="true"
statistics="true">
</cache>
<!-- 系统会话缓存 -->
<cache name="shiro-activeSessionCache"
maxElementsInMemory="10000"

View File

@ -135,6 +135,7 @@
$.table.init(options);
});
/** 清理参数缓存 */
function clearCache() {
$.operate.get(prefix + "/clearCache");
}

View File

@ -50,6 +50,9 @@
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:dict:export">
<i class="fa fa-download"></i> 导出
</a>
<a class="btn btn-danger" onclick="clearCache()" shiro:hasPermission="system:dict:remove">
<i class="fa fa-refresh"></i> 清理缓存
</a>
</div>
<div class="col-sm-12 select-table table-striped">
@ -132,6 +135,11 @@
var url = prefix + '/detail/' + dictId;
$.modal.openTab("字典数据", url);
}
/** 清理字典缓存 */
function clearCache() {
$.operate.get(prefix + "/clearCache");
}
</script>
</body>
</html>