24 lines
589 B
C#
24 lines
589 B
C#
using Microsoft.Extensions.Caching.Memory;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace Nirvana.Common
|
|
{
|
|
public static class MyCache
|
|
{
|
|
public static IServiceCollection serviceCollection;
|
|
public static MemoryCache get
|
|
{
|
|
get
|
|
{
|
|
var factory= serviceCollection.BuildServiceProvider().GetService(typeof(IMemoryCache));
|
|
MemoryCache cache = (MemoryCache)factory;
|
|
return cache;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|