Browse Source

Delete Comman

leiy 2 years ago
parent
commit
cf3cd6a99b

+ 0 - 35
OASystem/Common/Cache/ICacheService.cs

@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Common.Cache
-{
-    public interface ICacheService
-    {
-        /// <summary>
-        /// 设置缓存
-        /// </summary>
-        /// <typeparam name="T"></typeparam>
-        /// <param name="key"></param>
-        /// <param name="value"></param>
-        /// <param name="expiry"></param>
-        /// <returns></returns>
-        bool StringSet<T>(string key, T value, TimeSpan? expiry = null);
-
-        /// <summary>
-        /// 获取缓存
-        /// </summary>
-        /// <typeparam name="T"></typeparam>
-        /// <param name="key"></param>
-        /// <returns></returns>
-        T StringGet<T>(string key);
-
-        /// <summary>
-        /// 删除缓存
-        /// </summary>
-        /// <param name="key"></param>
-        void DeleteKey(string key);
-    }
-}

+ 0 - 43
OASystem/Common/Cache/OASystemCacheService.cs

@@ -1,43 +0,0 @@
-using Microsoft.Extensions.Caching.Memory;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Common.Cache
-{
-    public class OASystemCacheService : ICacheService
-    {
-        private readonly IMemoryCache _memoryCache;
-
-        public OASystemCacheService(IMemoryCache memoryCache)
-        {
-            _memoryCache = memoryCache;
-        }
-
-        public bool StringSet<T>(string key, T value, TimeSpan? expiry = null)
-        {
-            if (expiry == null)
-            {
-                _memoryCache.Set(key, value);
-            }
-            else
-            {
-                _memoryCache.Set(key, value, (TimeSpan)expiry);
-            }
-            return true;
-        }
-
-        public T StringGet<T>(string key)
-        {
-            T result = _memoryCache.Get<T>(key);
-            return result;
-        }
-
-        public void DeleteKey(string key)
-        {
-            _memoryCache.Remove(key);
-        }
-    }
-}

+ 0 - 13
OASystem/Common/Common.csproj

@@ -1,13 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>net6.0</TargetFramework>
-    <ImplicitUsings>enable</ImplicitUsings>
-    <Nullable>enable</Nullable>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" />
-  </ItemGroup>
-
-</Project>