예제 #1
0
 /// <summary>
 /// 先进先出优先队列 列表缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 /// <param name="getKey">缓存关键字获取器</param>
 /// <param name="getWhere">条件表达式获取器</param>
 /// <param name="maxCount">缓存默认最大容器大小</param>
 public queueList(counter <valueType, memberType, counterKeyType> counter
                  , func <valueType, keyType> getKey, func <keyType, Expression <func <valueType, bool> > > getWhere, int maxCount = 0)
     : base(counter, getKey, maxCount, getWhere)
 {
     counter.SqlTool.OnInsertedLock += onInserted;
     counter.OnUpdated += onUpdated;
     counter.OnDeleted += onDeleted;
 }
예제 #2
0
 /// <summary>
 /// 计数缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 protected counterCache(counter <valueType, memberType, keyType> counter)
 {
     if (counter == null)
     {
         log.Default.Throw(log.exceptionType.Null);
     }
     this.counter = counter;
 }
예제 #3
0
 /// <summary>
 /// 先进先出优先队列缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 /// <param name="getKey">缓存关键字获取器</param>
 /// <param name="maxCount">缓存默认最大容器大小</param>
 /// <param name="where">条件表达式</param>
 protected queueExpression(counter <valueType, memberType, counterKeyType> counter, func <valueType, keyType> getKey, int maxCount
                           , func <keyType, Expression <func <valueType, bool> > > getWhere)
     : base(counter, getKey, maxCount)
 {
     if (getWhere == null)
     {
         log.Default.Throw(log.exceptionType.Null);
     }
     this.getWhere = getWhere;
 }
예제 #4
0
 /// <summary>
 /// 先进先出优先队列缓存
 /// </summary>
 /// <param name="counter">缓存计数器</param>
 /// <param name="getKey">缓存关键字获取器</param>
 /// <param name="maxCount">缓存默认最大容器大小</param>
 protected queue(counter <valueType, memberType, counterKeyType> counter, func <valueType, keyType> getKey, int maxCount)
     : base(counter)
 {
     if (getKey == null)
     {
         log.Default.Throw(log.exceptionType.Null);
     }
     this.getKey   = getKey;
     this.maxCount = maxCount <= 0 ? config.sql.Default.CacheMaxCount : maxCount;
 }
예제 #5
0
        /// <summary>
        /// 先进先出优先队列自定义缓存
        /// </summary>
        /// <param name="counter">缓存计数器</param>
        /// <param name="getKey">缓存关键字获取器</param>
        /// <param name="where">条件表达式</param>
        /// <param name="maxCount">缓存默认最大容器大小</param>
        public queueExpressionCustom(counter <valueType, memberType, counterKeyType> counter, func <valueType, keyType> getKey
                                     , func <keyType, Expression <func <valueType, bool> > > getWhere, func <IEnumerable <valueType>, cacheValueType> getValue, int maxCount = 0)
            : base(counter, getKey, maxCount, getWhere)
        {
            if (getValue == null)
            {
                log.Default.Throw(log.exceptionType.Null);
            }
            this.getValue = getValue;

            counter.SqlTool.OnInsertedLock += onInserted;
            counter.OnUpdated += onUpdated;
            counter.OnDeleted += onDeleted;
        }
예제 #6
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(counter <valueType, memberType, counterKeyType> counter
                               , func <valueType, keyType> getKey, func <keyType, Expression <func <valueType, bool> > > getWhere
                               , func <valueType, dictionaryKeyType> getDictionaryKey
                               , int maxCount = 0)
            : base(counter, getKey, maxCount, getWhere)
        {
            if (getDictionaryKey == null)
            {
                log.Default.Throw(log.exceptionType.Null);
            }
            this.getDictionaryKey = getDictionaryKey;

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