Ejemplo n.º 1
0
        /// <summary>
        /// 增加数据
        /// </summary>
        /// <param name="value">新增的数据</param>
        protected void onInserted(valueType value)
        {
            keyType key = getKey(value);
            listOrderLadyValue <valueType> cache = queueCache.Get(key, default(listOrderLadyValue <valueType>));

            if (cache.List != null)
            {
                valueType newValue = fastCSharp.setup.constructor <valueType> .New;
                copyFrom(newValue, value, memberMap);
                cache.List.Add(newValue);
                cache.Array     = null;
                cache.IsSort    = false;
                queueCache[key] = cache;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取数据集合
        /// </summary>
        /// <param name="key">关键字</param>
        /// <returns>数据集合</returns>
        protected listOrderLadyValue <valueType> getCache(keyType key)
        {
            listOrderLadyValue <valueType> cache = queueCache.Get(key, default(listOrderLadyValue <valueType>));

            if (cache.List == null)
            {
                cache.List      = SqlTool.Where(getWhere(key), memberMap).getList() ?? new list <valueType>();
                queueCache[key] = cache;
                if (queueCache.Count > maxCount)
                {
                    queueCache.Pop();
                }
            }
            return(cache);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取数据集合
 /// </summary>
 /// <param name="key">关键字</param>
 /// <returns>数据集合</returns>
 public valueType[] GetArray(keyType key)
 {
     Monitor.Enter(SqlTool.Lock);
     try
     {
         listOrderLadyValue <valueType> cache = getCache(key);
         if (cache.Array == null)
         {
             cache.Array     = cache.List.getArray();
             cache.IsSort    = false;
             queueCache[key] = cache;
         }
         return(cache.Array);
     }
     finally { Monitor.Exit(SqlTool.Lock); }
 }