From 98e49c0dd42840a094837f7acae532bc237a719a Mon Sep 17 00:00:00 2001 From: yangyin <1850366751@qq.com> Date: 星期二, 20 八月 2024 15:42:37 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- Service/HStation.Service.Assets.Core/05-service/00-core/02-cache/CacheHelper.cs | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/Service/HStation.Service.Assets.Core/05-service/00-core/02-cache/CacheHelper.cs b/Service/HStation.Service.Assets.Core/05-service/00-core/02-cache/CacheHelper.cs new file mode 100644 index 0000000..4619fc5 --- /dev/null +++ b/Service/HStation.Service.Assets.Core/05-service/00-core/02-cache/CacheHelper.cs @@ -0,0 +1,30 @@ +锘縩amespace HStation.Service +{ + /// <summary> + /// 缂撳瓨杈呭姪绫� + /// </summary> + internal class CacheHelper + { + private const string _cacheKeyPrefix = "Assets";//缂撳瓨閿墠缂� + + /// <summary> + /// 鑾峰彇缂撳瓨閿� + /// </summary> + public static string GetCacheKey(string keyContent) + { + return MemoryCacheKeyHelper.GetKey(HStation.Assets.MemoryCacheKey.ServiceLevel, HStation.Assets.MemoryCacheKey.Module, $"*{_cacheKeyPrefix}*_{keyContent}"); + } + + /// <summary> + /// 娓呴櫎鍏ㄩ儴 + /// </summary> + public static void Clear() + { + Yw.MemoryCacheHelper.Remove((key) => + { + var prefix = MemoryCacheKeyHelper.GetKey(HStation.Assets.MemoryCacheKey.ServiceLevel, HStation.Assets.MemoryCacheKey.Module, $"*{_cacheKeyPrefix}*"); + return key.StartsWith(prefix); + }); + } + } +} \ No newline at end of file -- Gitblit v1.9.3