Exemplo n.º 1
0
        /// <summary>
        /// 根据对象获取缓存区域的键
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public string GetRegionCacheKey(object entity)
        {
            if (CacheKeyUtil.DefaultRegionName == RegionName)
            {
                return(CacheKeyUtil.GetRegionCacheKey(EntityType, RegionName, null));
            }

            return(CacheKeyUtil.GetRegionCacheKey(EntityType, RegionName, RegionValueFunc(entity)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 创建缓存区域定义对象
        /// </summary>
        public static CacheRegion Create(Type entityType, string regionName, object value)
        {
            if (String.IsNullOrEmpty(regionName))
            {
                regionName = CacheKeyUtil.DefaultRegionName;
            }

            return(new CacheRegion()
            {
                RegionName = regionName,
                CacheKey = CacheKeyUtil.GetRegionCacheKey(entityType, regionName, value),
                EntityType = entityType
            });
        }