CacheExtension.cs 642 B

123456789101112131415161718192021222324
  1. using ERP.Framework.Cache;
  2. using ERP.Framework.Config;
  3. using Microsoft.Extensions.DependencyInjection;
  4. namespace ERP.Framework.Extensions
  5. {
  6. public static class CacheExtension
  7. {
  8. /// <summary>
  9. ///
  10. /// </summary>
  11. /// <param name="services"></param>
  12. /// <param name="config"></param>
  13. /// <returns></returns>
  14. public static void AddCache(this IServiceCollection services, RedisConfig config)
  15. {
  16. // 内存缓存 如有需要再做处理
  17. services.AddMemoryCache();
  18. // 初始化Redis
  19. RedisHelper.Init(config);
  20. }
  21. }
  22. }