OL.FrameCore.Application/CacheManage/CacheManageService.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using Microsoft.EntityFrameworkCore;
using OL.FrameCore.Application.CacheManage.Dto;
using OL.FrameCore.Infrastructure.Cache;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OL.FrameCore.Application.CacheManage
{
public class CacheManageService : ICacheManageService
{
/// <summary>
/// 获取缓存列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public PageData<GetCacheListResponse> GetCacheList(GetCacheListRequest request)
{
var list = CacheManager.GetAllCacheList();
var query = from a in list
where string.IsNullOrEmpty(request.Key) ? true : a.Key.Contains(request.Key)
select a;
list = query.Skip(request.PageSize * request.PageIndex).Take(request.PageSize).ToList();
var result = list.Select(p => new GetCacheListResponse
{
CacheKey = p.Key,
CreateTime = p.CreateTime,
ExpireTime = p.ExpireTime
}).ToList();
return new PageData<GetCacheListResponse>
{
Items = result,
ItemsCount = list.Count,
PageIndex = request.PageIndex,
PageSize = request.PageSize
};
}
/// <summary>
/// 获取缓存内容
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public GetCacheContentResponse GetCacheContent(string key)
{
var data = CacheManager.GetCache<string>(key);
return new GetCacheContentResponse
{
Key = key,
Content = data
};
}
/// <summary>
/// 删除缓存
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public Result DeleteCache(string key)
{
CacheManager.RemoveCache(key);
后面还有 4 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
