CacheManagerSettingExtensions.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections.Generic;
  2. using Abp.Runtime.Caching;
  3. namespace Abp.Configuration
  4. {
  5. /// <summary>
  6. /// Extension methods for <see cref="ICacheManager"/> to get setting caches.
  7. /// </summary>
  8. public static class CacheManagerSettingExtensions
  9. {
  10. /// <summary>
  11. /// Gets application settings cache.
  12. /// </summary>
  13. public static ITypedCache<string, Dictionary<string, SettingInfo>> GetApplicationSettingsCache(this ICacheManager cacheManager)
  14. {
  15. return cacheManager
  16. .GetCache<string, Dictionary<string, SettingInfo>>(AbpCacheNames.ApplicationSettings);
  17. }
  18. /// <summary>
  19. /// Gets tenant settings cache.
  20. /// </summary>
  21. public static ITypedCache<int, Dictionary<string, SettingInfo>> GetTenantSettingsCache(this ICacheManager cacheManager)
  22. {
  23. return cacheManager
  24. .GetCache<int, Dictionary<string, SettingInfo>>(AbpCacheNames.TenantSettings);
  25. }
  26. /// <summary>
  27. /// Gets user settings cache.
  28. /// </summary>
  29. public static ITypedCache<string, Dictionary<string, SettingInfo>> GetUserSettingsCache(this ICacheManager cacheManager)
  30. {
  31. return cacheManager
  32. .GetCache<string, Dictionary<string, SettingInfo>>(AbpCacheNames.UserSettings);
  33. }
  34. }
  35. }