😎增加清空缓存
This commit is contained in:
parent
78caebebb8
commit
ce138fc6fa
@ -132,6 +132,7 @@ public class SysMenuSeedData : ISqlSugarEntitySeedData<SysMenu>
|
|||||||
new SysMenu{ Id=1310000000371, Pid=1310000000301, Title="缓存管理", Path="/platform/cache", Name="sysCache", Component="/system/cache/index", Icon="ele-Loading", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=160 },
|
new SysMenu{ Id=1310000000371, Pid=1310000000301, Title="缓存管理", Path="/platform/cache", Name="sysCache", Component="/system/cache/index", Icon="ele-Loading", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=160 },
|
||||||
new SysMenu{ Id=1310000000372, Pid=1310000000371, Title="查询", Permission="sysCache/keyList", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
new SysMenu{ Id=1310000000372, Pid=1310000000371, Title="查询", Permission="sysCache/keyList", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||||
new SysMenu{ Id=1310000000373, Pid=1310000000371, Title="删除", Permission="sysCache/delete", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
new SysMenu{ Id=1310000000373, Pid=1310000000371, Title="删除", Permission="sysCache/delete", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||||
|
new SysMenu{ Id=1310000000374, Pid=1310000000371, Title="清空", Permission="sysCache/clear", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||||
|
|
||||||
new SysMenu{ Id=1310000000381, Pid=1310000000301, Title="行政区域", Path="/platform/region", Name="sysRegion", Component="/system/region/index", Icon="ele-LocationInformation", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=170 },
|
new SysMenu{ Id=1310000000381, Pid=1310000000301, Title="行政区域", Path="/platform/region", Name="sysRegion", Component="/system/region/index", Icon="ele-LocationInformation", Type=MenuTypeEnum.Menu, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=170 },
|
||||||
new SysMenu{ Id=1310000000382, Pid=1310000000381, Title="查询", Permission="sysRegion/page", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
new SysMenu{ Id=1310000000382, Pid=1310000000381, Title="查询", Permission="sysRegion/page", Type=MenuTypeEnum.Btn, CreateTime=DateTime.Parse("2022-02-10 00:00:00"), OrderNo=100 },
|
||||||
|
|||||||
@ -115,6 +115,7 @@ public class SysRoleMenuSeedData : ISqlSugarEntitySeedData<SysRoleMenu>
|
|||||||
new SysRoleMenu{ Id=1300000000271, RoleId=1300000000101, MenuId=1310000000371 },
|
new SysRoleMenu{ Id=1300000000271, RoleId=1300000000101, MenuId=1310000000371 },
|
||||||
new SysRoleMenu{ Id=1300000000272, RoleId=1300000000101, MenuId=1310000000372 },
|
new SysRoleMenu{ Id=1300000000272, RoleId=1300000000101, MenuId=1310000000372 },
|
||||||
new SysRoleMenu{ Id=1300000000273, RoleId=1300000000101, MenuId=1310000000373 },
|
new SysRoleMenu{ Id=1300000000273, RoleId=1300000000101, MenuId=1310000000373 },
|
||||||
|
new SysRoleMenu{ Id=1300000000274, RoleId=1300000000101, MenuId=1310000000374 },
|
||||||
// 行政区域
|
// 行政区域
|
||||||
new SysRoleMenu{ Id=1300000000281, RoleId=1300000000101, MenuId=1310000000381 },
|
new SysRoleMenu{ Id=1300000000281, RoleId=1300000000101, MenuId=1310000000381 },
|
||||||
new SysRoleMenu{ Id=1300000000282, RoleId=1300000000101, MenuId=1310000000382 },
|
new SysRoleMenu{ Id=1300000000282, RoleId=1300000000101, MenuId=1310000000382 },
|
||||||
|
|||||||
@ -178,6 +178,19 @@ public class SysCacheService : IDynamicApiController, ISingleton
|
|||||||
return _cacheProvider.Cache.Remove($"{_cacheOptions.Prefix}{key}");
|
return _cacheProvider.Cache.Remove($"{_cacheOptions.Prefix}{key}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清空所有缓存 🔖
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[DisplayName("清空所有缓存")]
|
||||||
|
[ApiDescriptionSettings(Name = "Clear")]
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
_cacheProvider.Cache.Clear();
|
||||||
|
|
||||||
|
Cache.Default.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查缓存是否存在
|
/// 检查缓存是否存在
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -26,6 +26,49 @@ import { AdminResultObject } from '../models';
|
|||||||
*/
|
*/
|
||||||
export const SysCacheApiAxiosParamCreator = function (configuration?: Configuration) {
|
export const SysCacheApiAxiosParamCreator = function (configuration?: Configuration) {
|
||||||
return {
|
return {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 清空所有缓存 🔖
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
apiSysCacheClearDelete: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||||
|
const localVarPath = `/api/sysCache/clear`;
|
||||||
|
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||||
|
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||||
|
let baseOptions;
|
||||||
|
if (configuration) {
|
||||||
|
baseOptions = configuration.baseOptions;
|
||||||
|
}
|
||||||
|
const localVarRequestOptions :AxiosRequestConfig = { method: 'DELETE', ...baseOptions, ...options};
|
||||||
|
const localVarHeaderParameter = {} as any;
|
||||||
|
const localVarQueryParameter = {} as any;
|
||||||
|
|
||||||
|
// authentication Bearer required
|
||||||
|
// http bearer authentication required
|
||||||
|
if (configuration && configuration.accessToken) {
|
||||||
|
const accessToken = typeof configuration.accessToken === 'function'
|
||||||
|
? await configuration.accessToken()
|
||||||
|
: await configuration.accessToken;
|
||||||
|
localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = new URLSearchParams(localVarUrlObj.search);
|
||||||
|
for (const key in localVarQueryParameter) {
|
||||||
|
query.set(key, localVarQueryParameter[key]);
|
||||||
|
}
|
||||||
|
for (const key in options.params) {
|
||||||
|
query.set(key, options.params[key]);
|
||||||
|
}
|
||||||
|
localVarUrlObj.search = (new URLSearchParams(query)).toString();
|
||||||
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
||||||
|
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
|
||||||
|
|
||||||
|
return {
|
||||||
|
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
|
||||||
|
options: localVarRequestOptions,
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 根据键名前缀删除缓存 🔖
|
* @summary 根据键名前缀删除缓存 🔖
|
||||||
@ -274,6 +317,19 @@ export const SysCacheApiAxiosParamCreator = function (configuration?: Configurat
|
|||||||
*/
|
*/
|
||||||
export const SysCacheApiFp = function(configuration?: Configuration) {
|
export const SysCacheApiFp = function(configuration?: Configuration) {
|
||||||
return {
|
return {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 清空所有缓存 🔖
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysCacheClearDelete(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||||
|
const localVarAxiosArgs = await SysCacheApiAxiosParamCreator(configuration).apiSysCacheClearDelete(options);
|
||||||
|
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||||
|
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||||
|
return axios.request(axiosRequestArgs);
|
||||||
|
};
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 根据键名前缀删除缓存 🔖
|
* @summary 根据键名前缀删除缓存 🔖
|
||||||
@ -352,6 +408,15 @@ export const SysCacheApiFp = function(configuration?: Configuration) {
|
|||||||
*/
|
*/
|
||||||
export const SysCacheApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
export const SysCacheApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
|
||||||
return {
|
return {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 清空所有缓存 🔖
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
*/
|
||||||
|
async apiSysCacheClearDelete(options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||||
|
return SysCacheApiFp(configuration).apiSysCacheClearDelete(options).then((request) => request(axios, basePath));
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 根据键名前缀删除缓存 🔖
|
* @summary 根据键名前缀删除缓存 🔖
|
||||||
@ -411,6 +476,16 @@ export const SysCacheApiFactory = function (configuration?: Configuration, baseP
|
|||||||
* @extends {BaseAPI}
|
* @extends {BaseAPI}
|
||||||
*/
|
*/
|
||||||
export class SysCacheApi extends BaseAPI {
|
export class SysCacheApi extends BaseAPI {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @summary 清空所有缓存 🔖
|
||||||
|
* @param {*} [options] Override http request option.
|
||||||
|
* @throws {RequiredError}
|
||||||
|
* @memberof SysCacheApi
|
||||||
|
*/
|
||||||
|
public async apiSysCacheClearDelete(options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||||
|
return SysCacheApiFp(this.configuration).apiSysCacheClearDelete(options).then((request) => request(this.axios, this.basePath));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @summary 根据键名前缀删除缓存 🔖
|
* @summary 根据键名前缀删除缓存 🔖
|
||||||
|
|||||||
26
Web/src/views/system/cache/index.vue
vendored
26
Web/src/views/system/cache/index.vue
vendored
@ -10,7 +10,10 @@
|
|||||||
<template #header>
|
<template #header>
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
<span>缓存列表</span>
|
<span>缓存列表</span>
|
||||||
<el-button icon="ele-Refresh" size="small" circle @click="handleQuery" v-auth="'sysCache/keyList'" />
|
<div>
|
||||||
|
<el-button icon="ele-Refresh" size="small" type="success" circle plain @click="handleQuery" v-auth="'sysCache/keyList'" />
|
||||||
|
<el-button icon="ele-DeleteFilled" size="small" type="danger" circle plain @click="clearCache" v-auth="'sysCache/clear'"> </el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-tree
|
<el-tree
|
||||||
@ -67,7 +70,7 @@ const state = reactive({
|
|||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
handleQuery();
|
await handleQuery();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 查询操作
|
// 查询操作
|
||||||
@ -115,7 +118,7 @@ const delCache = () => {
|
|||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await getAPI(SysCacheApi).apiSysCacheDeleteKeyPost(currentNode.value.id);
|
await getAPI(SysCacheApi).apiSysCacheDeleteKeyPost(currentNode.value.id);
|
||||||
handleQuery();
|
await handleQuery();
|
||||||
state.cacheValue = undefined;
|
state.cacheValue = undefined;
|
||||||
state.cacheKey = undefined;
|
state.cacheKey = undefined;
|
||||||
ElMessage.success('删除成功');
|
ElMessage.success('删除成功');
|
||||||
@ -123,6 +126,23 @@ const delCache = () => {
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 清空
|
||||||
|
const clearCache = () => {
|
||||||
|
ElMessageBox.confirm(`确认清空所有缓存?`, '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
.then(async () => {
|
||||||
|
await getAPI(SysCacheApi).apiSysCacheClearDelete();
|
||||||
|
await handleQuery();
|
||||||
|
state.cacheValue = undefined;
|
||||||
|
state.cacheKey = undefined;
|
||||||
|
ElMessage.success('清空成功');
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
// 树点击
|
// 树点击
|
||||||
const nodeClick = async (node: any) => {
|
const nodeClick = async (node: any) => {
|
||||||
if (node.id == 0) return;
|
if (node.id == 0) return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user