コード例 #1
0
 /// <summary>
 /// 获取type属性cache
 /// </summary>
 /// <param name="type"></param>
 /// <param name="cachePropertiesKey"></param>
 /// <param name="cachePropertiesManager"></param>
 /// <returns></returns>
 internal static PropertyInfo[] GetGetPropertiesByCache(Type type, string cachePropertiesKey, CacheManager <PropertyInfo[]> cachePropertiesManager)
 {
     PropertyInfo[] props = null;
     if (cachePropertiesManager.ContainsKey(cachePropertiesKey))
     {
         props = cachePropertiesManager[cachePropertiesKey];
     }
     else
     {
         props = type.GetProperties();
         cachePropertiesManager.Add(cachePropertiesKey, props, cachePropertiesManager.Day);
     }
     return(props);
 }
コード例 #2
0
ファイル: CacheManager.cs プロジェクト: zdl8061/sqlsugar
 public static CacheManager <V> GetInstance()
 {
     if (_instance == null)
     {
         lock (_instanceLock)
             if (_instance == null)
             {
                 _instance = new CacheManager <V>();
                 Action addItem = () => { CacheManager <V> .GetInstance().RemoveAllCache(); };
                 CacheManager.Add(addItem);
             }
     }
     return(_instance);
 }