mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-07 02:00:51 +08:00
添加excel模块
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Caching.MemoryCache
|
||||
{
|
||||
public class MemoryCacheClient : CacheManager
|
||||
{
|
||||
private IMemoryCache _client;
|
||||
public MemoryCacheClient()
|
||||
{
|
||||
_client = new Microsoft.Extensions.Caching.Memory.MemoryCache(new MemoryCacheOptions());
|
||||
}
|
||||
public override bool Exits(string key)
|
||||
{
|
||||
return _client.TryGetValue(key, out var _);
|
||||
}
|
||||
public override T Get<T>(string key)
|
||||
{
|
||||
return _client.Get<T>(key);
|
||||
}
|
||||
public override bool Set<T>(string key, T item)
|
||||
{
|
||||
return _client.Set(key, item) is not null;
|
||||
}
|
||||
|
||||
public override bool Set<T>(string key, T item, TimeSpan time)
|
||||
{
|
||||
return _client.Set(key, item, time) is not null;
|
||||
}
|
||||
|
||||
public override long Del(string key)
|
||||
{
|
||||
_client.Remove(key);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\framework\Yi.Framework.Core\Yi.Framework.Core.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Caching\Yi.Framework.Caching.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StartupModules;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Caching.MemoryCache;
|
||||
using Yi.Framework.Caching;
|
||||
|
||||
namespace Yi.Framework.Ddd
|
||||
{
|
||||
public class YiFrameworkCachingMemoryCacheModule:IStartupModule
|
||||
{
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
services.AddSingleton<CacheManager, MemoryCacheClient>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user