Blame view

Yi.Abp.Net8/module/setting-management/Yi.Framework.SettingManagement.Domain/SettingCacheItem.cs 881 Bytes
515fceeb   “wangming”   框架初始化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  using System;
  using System.Linq;
  using Volo.Abp.MultiTenancy;
  using Volo.Abp.Text.Formatting;
  
  namespace Yi.Framework.SettingManagement.Domain;
  
  [Serializable]
  [IgnoreMultiTenancy]
  public class SettingCacheItem
  {
      private const string CacheKeyFormat = "pn:{0},pk:{1},n:{2}";
  
      public string Value { get; set; }
  
      public SettingCacheItem()
      {
  
      }
  
      public SettingCacheItem(string value)
      {
          Value = value;
      }
  
      public static string CalculateCacheKey(string name, string providerName, string providerKey)
      {
          return string.Format(CacheKeyFormat, providerName, providerKey, name);
      }
  
      public static string GetSettingNameFormCacheKeyOrNull(string cacheKey)
      {
          var result = FormattedStringValueExtracter.Extract(cacheKey, CacheKeyFormat, true);
          return result.IsMatch ? result.Matches.Last().Value : null;
      }
  }