Ejemplo n.º 1
0
        /// <summary>
        /// 获取列表缓存CacheKey的前缀(例如:abe3ds2sa90:8:)
        /// </summary>
        /// <param name="cacheVersionSetting"></param>
        /// <returns></returns>
        public string GetListCacheKeyPrefix(IListCacheSetting cacheVersionSetting)
        {
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(this.TypeHashID);
            stringBuilder.Append("-L:");
            switch (cacheVersionSetting.CacheVersionType)
            {
            case CacheVersionType.GlobalVersion:
                stringBuilder.AppendFormat("{0}:", this.GetGlobalVersion());
                break;

            case CacheVersionType.AreaVersion:
                stringBuilder.AppendFormat("{0}-{1}-{2}:", cacheVersionSetting.AreaCachePropertyName, cacheVersionSetting.AreaCachePropertyValue.ToString(), this.GetAreaVersion(cacheVersionSetting.AreaCachePropertyName, cacheVersionSetting.AreaCachePropertyValue));
                break;
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取列表缓存CacheKey的前缀(例如:abe3ds2sa90:8:)
        /// </summary>
        /// <param name="cacheVersionSetting">列表缓存设置</param>
        /// <returns>列表缓存CacheKey的前缀</returns>
        public string GetListCacheKeyPrefix(IListCacheSetting cacheVersionSetting)
        {
            StringBuilder cacheKeyPrefix = new StringBuilder(TypeHashID);

            cacheKeyPrefix.Append("-L:");
            switch (cacheVersionSetting.CacheVersionType)
            {
            case CacheVersionType.GlobalVersion:
                cacheKeyPrefix.AppendFormat("{0}:", GetGlobalVersion());
                break;

            case CacheVersionType.AreaVersion:
                cacheKeyPrefix.AppendFormat("{0}-{1}-{2}:", cacheVersionSetting.AreaCachePropertyName, cacheVersionSetting.AreaCachePropertyValue.ToString(), GetAreaVersion(cacheVersionSetting.AreaCachePropertyName, cacheVersionSetting.AreaCachePropertyValue));
                break;
            }
            return(cacheKeyPrefix.ToString());
        }
 /// <summary>
 /// 获取列表缓存CacheKey的前缀(例如:abe3ds2sa90:8:)
 /// 
 /// </summary>
 /// <param name="cacheVersionSetting">列表缓存设置</param>
 /// <returns>
 /// 列表缓存CacheKey的前缀
 /// </returns>
 public string GetListCacheKeyPrefix(IListCacheSetting cacheVersionSetting)
 {
     StringBuilder stringBuilder = new StringBuilder(this.TypeHashID);
     stringBuilder.Append("-L:");
     switch (cacheVersionSetting.CacheVersionType)
     {
         case CacheVersionType.GlobalVersion:
             stringBuilder.AppendFormat("{0}:", (object) this.GetGlobalVersion());
             break;
         case CacheVersionType.AreaVersion:
             stringBuilder.AppendFormat("{0}-{1}-{2}:", (object) cacheVersionSetting.AreaCachePropertyName,
                 (object) cacheVersionSetting.AreaCachePropertyValue.ToString(),
                 (object)
                     this.GetAreaVersion(cacheVersionSetting.AreaCachePropertyName,
                         cacheVersionSetting.AreaCachePropertyValue));
             break;
     }
     return stringBuilder.ToString();
 }