Ejemplo n.º 1
0
        /// <summary>
        /// 分组列表缓存
        /// </summary>
        /// <param name="cache">整表缓存</param>
        /// <param name="getKey">分组字典关键字获取器</param>
        public dictionary(eventCache <valueType, memberType> cache, func <valueType, keyType> getKey)
        {
            if (cache == null || getKey == null)
            {
                log.Default.Throw(log.exceptionType.Null);
            }
            this.cache  = cache;
            this.getKey = getKey;

            cache.OnInserted += onInserted;
            cache.OnUpdated  += onUpdated;
            cache.OnDeleted  += onDeleted;

            reset();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 超时缓存
        /// </summary>
        /// <param name="cache">整表缓存</param>
        /// <param name="getTime">时间获取器</param>
        /// <param name="timeOutSeconds">超时秒数</param>
        /// <param name="getKey">关键字获取器</param>
        /// <param name="isValue">数据匹配器</param>
        public timeOutOrderLadyWhere(eventCache <valueType, memberType> cache
                                     , double timeOutSeconds, func <valueType, DateTime> getTime, func <valueType, bool> isValue)
            : base(cache, timeOutSeconds, getTime, false)
        {
            if (isValue == null)
            {
                log.Default.Throw(log.exceptionType.Null);
            }
            this.isValue = isValue;

            cache.OnInserted += onInserted;
            cache.OnUpdated  += onUpdated;
            cache.OnDeleted  += onDeleted;

            reset();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 分组列表缓存
        /// </summary>
        /// <param name="cache">整表缓存</param>
        /// <param name="getKey">分组字典关键字获取器</param>
        /// <param name="isValue">数据匹配器</param>
        public dictionaryListWhere
            (eventCache <valueType, memberType> cache, func <valueType, keyType> getKey, func <valueType, bool> isValue)
            : base(cache, getKey, false)
        {
            if (isValue == null)
            {
                log.Default.Throw(log.exceptionType.Null);
            }
            this.isValue = isValue;

            cache.OnInserted += onInserted;
            cache.OnUpdated  += onUpdated;
            cache.OnDeleted  += onDeleted;

            reset();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 分组字典缓存
        /// </summary>
        /// <param name="cache">整表缓存</param>
        /// <param name="getGroupKey">分组关键字获取器</param>
        /// <param name="getKey">字典关键字获取器</param>
        /// <param name="isValue">数据匹配器</param>
        public dictionaryDictionaryWhere(eventCache <valueType, memberType> cache
                                         , func <valueType, groupKeyType> getGroupKey, func <valueType, keyType> getKey, func <valueType, bool> isValue)
        {
            if (cache == null || getGroupKey == null || getKey == null || isValue == null)
            {
                log.Default.Throw(log.exceptionType.Null);
            }
            this.cache       = cache;
            this.getGroupKey = getGroupKey;
            this.getKey      = getKey;
            this.isValue     = isValue;

            cache.OnInserted += onInserted;
            cache.OnUpdated  += onUpdated;
            cache.OnDeleted  += onDeleted;

            reset();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 分组列表 延时排序缓存
        /// </summary>
        /// <param name="cache">整表缓存</param>
        /// <param name="getKey">分组字典关键字获取器</param>
        /// <param name="sorter">排序器</param>
        /// <param name="isReset">是否初始化</param>
        public dictionaryListOrderLady(eventCache <valueType, memberType> cache
                                       , func <valueType, keyType> getKey, func <list <valueType>, valueType[]> sorter, bool isReset = true)
        {
            if (cache == null || getKey == null || sorter == null)
            {
                log.Default.Throw(log.exceptionType.Null);
            }
            this.cache  = cache;
            this.getKey = getKey;
            this.sorter = sorter;

            if (isReset)
            {
                cache.OnInserted += onInserted;
                cache.OnUpdated  += onUpdated;
                cache.OnDeleted  += onDeleted;

                reset();
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 超时缓存
        /// </summary>
        /// <param name="cache">整表缓存</param>
        /// <param name="getTime">时间获取器</param>
        /// <param name="timeOutSeconds">超时秒数</param>
        /// <param name="getKey">关键字获取器</param>
        /// <param name="isReset">是否绑定事件与重置数据</param>
        public timeOutOrderLady(eventCache <valueType, memberType> cache
                                , double timeOutSeconds, func <valueType, DateTime> getTime, bool isReset = true)
        {
            if (cache == null || timeOutSeconds < 1 || getTime == null)
            {
                log.Default.Throw(log.exceptionType.Null);
            }
            this.cache          = cache;
            this.timeOutSeconds = -timeOutSeconds;
            this.getTime        = getTime;

            if (isReset)
            {
                cache.OnInserted += onInserted;
                cache.OnUpdated  += onUpdated;
                cache.OnDeleted  += onDeleted;

                reset();
            }
        }