Ejemplo n.º 1
0
 /// <summary>
 /// 先进先出优先队列缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 /// <param name="getKey">缓存关键字获取器</param>
 /// <param name="maxCount">缓存默认最大容器大小</param>
 protected memberQueueList(events.counter <valueType, modelType, couterKeyType> counter, Expression <Func <modelType, keyType> > getKey
                           , Expression <Func <memberCacheType, cacheValueType> > valueMember, Expression <Func <memberCacheType, memberCacheType> > previousMember
                           , Expression <Func <memberCacheType, memberCacheType> > nextMember, int maxCount)
     : this(counter, getKey.Compile(), valueMember, previousMember, nextMember, maxCount)
 {
     counter.SqlTool.SetSelectMember(getKey);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 计数缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 protected counterCache(events.counter <valueType, modelType, keyType> counter)
 {
     if (counter == null)
     {
         log.Error.Throw(log.exceptionType.Null);
     }
     this.counter = counter;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 先进先出优先队列 列表缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 /// <param name="getKey">缓存关键字获取器</param>
 /// <param name="getWhere">条件表达式获取器</param>
 /// <param name="maxCount">缓存默认最大容器大小</param>
 public queueList(events.counter <valueType, modelType, counterKeyType> counter
                  , Expression <Func <modelType, keyType> > getKey, Func <keyType, Expression <Func <modelType, bool> > > getWhere, int maxCount = 0)
     : base(counter, getKey, maxCount, getWhere)
 {
     counter.OnReset += reset;
     counter.SqlTool.OnInsertedLock += onInserted;
     counter.OnUpdated += onUpdated;
     counter.OnDeleted += onDeleted;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 先进先出优先队列缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 /// <param name="getKey">缓存关键字获取器</param>
 /// <param name="maxCount">缓存默认最大容器大小</param>
 /// <param name="getWhere">条件表达式获取器</param>
 protected queueExpression(events.counter <valueType, modelType, counterKeyType> counter, Expression <Func <modelType, keyType> > getKey, int maxCount
                           , Func <keyType, Expression <Func <modelType, bool> > > getWhere)
     : base(counter, getKey, maxCount)
 {
     if (getWhere == null)
     {
         log.Error.Throw(log.exceptionType.Null);
     }
     this.getWhere = getWhere;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 先进先出优先队列缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 /// <param name="getKey">缓存关键字获取器</param>
 /// <param name="maxCount">缓存默认最大容器大小</param>
 protected queue(events.counter <valueType, modelType, counterKeyType> counter, Func <modelType, keyType> getKey, int maxCount)
     : base(counter)
 {
     if (getKey == null)
     {
         log.Error.Throw(log.exceptionType.Null);
     }
     this.getKey   = getKey;
     this.maxCount = maxCount <= 0 ? config.sql.Default.CacheMaxCount : maxCount;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 先进先出优先队列缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 /// <param name="getKey">缓存关键字获取器</param>
 /// <param name="maxCount">缓存默认最大容器大小</param>
 protected queue(events.counter <valueType, modelType, counterKeyType> counter, Expression <Func <modelType, keyType> > getKey, int maxCount)
     : base(counter)
 {
     if (getKey == null)
     {
         log.Error.Throw(log.exceptionType.Null);
     }
     counter.SqlTool.SetSelectMember(getKey);
     this.getKey   = getKey.Compile();
     this.maxCount = maxCount <= 0 ? config.sql.Default.CacheMaxCount : maxCount;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 先进先出优先队列缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 /// <param name="getKey">缓存关键字获取器</param>
 /// <param name="maxCount">缓存默认最大容器大小</param>
 protected memberQueueList(events.counter <valueType, modelType, couterKeyType> counter, Func <modelType, keyType> getKey
                           , Expression <Func <memberCacheType, cacheValueType> > valueMember, Expression <Func <memberCacheType, memberCacheType> > previousMember
                           , Expression <Func <memberCacheType, memberCacheType> > nextMember, int maxCount)
     : base(valueMember, previousMember, nextMember, maxCount)
 {
     if (counter == null || getKey == null)
     {
         log.Error.Throw(log.exceptionType.Null);
     }
     this.counter = counter;
     this.getKey  = getKey;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 先进先出优先队列自定义缓存
        /// </summary>
        /// <param name="counter">缓存计数器</param>
        /// <param name="getKey">缓存关键字获取器</param>
        /// <param name="getWhere">条件表达式获取器</param>
        /// <param name="getValue">自定义缓存获取器</param>
        /// <param name="maxCount">缓存默认最大容器大小</param>
        public queueExpressionCustom(events.counter <valueType, modelType, counterKeyType> counter, Expression <Func <modelType, keyType> > getKey
                                     , Func <keyType, Expression <Func <modelType, bool> > > getWhere, Func <keyType, IEnumerable <valueType>, cacheValueType> getValue, int maxCount = 0)
            : base(counter, getKey, maxCount, getWhere)
        {
            if (getValue == null)
            {
                log.Error.Throw(log.exceptionType.Null);
            }
            this.getValue = getValue;


            counter.OnReset += reset;
            counter.SqlTool.OnInsertedLock += onInserted;
            counter.OnUpdated += onUpdated;
            counter.OnDeleted += onDeleted;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 先进先出优先队列 字典缓存
        /// </summary>
        /// <param name="counter">缓存计数器</param>
        /// <param name="getKey">缓存关键字获取器</param>
        /// <param name="getWhere">条件表达式获取器</param>
        /// <param name="getDictionaryKey">缓存字典关键字获取器</param>
        /// <param name="maxCount">缓存默认最大容器大小</param>
        public queueDictionary(events.counter <valueType, modelType, counterKeyType> counter
                               , Expression <Func <modelType, keyType> > getKey, Func <keyType, Expression <Func <modelType, bool> > > getWhere
                               , Func <valueType, dictionaryKeyType> getDictionaryKey
                               , int maxCount = 0)
            : base(counter, getKey, maxCount, getWhere)
        {
            if (getDictionaryKey == null)
            {
                log.Error.Throw(log.exceptionType.Null);
            }
            this.getDictionaryKey = getDictionaryKey;

            counter.OnReset += reset;
            counter.SqlTool.OnInsertedLock += onInserted;
            counter.OnUpdated += onUpdated;
            counter.OnDeleted += onDeleted;
        }