示例#1
0
        public string DebugCacheStatus()
        {
            string        strStatus  = string.Empty;
            List <string> strKeyList = m_CacheHitRatio.KeyList();
            Int32         nSize      = strKeyList == null ? 0 : strKeyList.Count;

            for (Int32 i = 0; i < nSize; ++i)
            {
                string         strKey   = strKeyList[i];
                CCacheHitRatio cacheHit = null;
                CCacheSet      cacheSet = null;
                if (m_CacheHitRatio.QuickFind(strKey, ref cacheHit) == false || cacheHit == null)
                {
                    continue;
                }
                m_Cache.QuickFind(strKey, ref cacheSet);

                strStatus += string.Format("Cache:{0}, Try Times:{1}, Hit Times:{2}, Hit Ratio:{3:P2}, Cache Count:{4}, Cache Slot:{5}",
                                           strKey,
                                           cacheHit.MissTime + cacheHit.HitTime,
                                           cacheHit.HitTime,
                                           cacheHit.HitRation(),
                                           cacheSet == null ? 0 : cacheSet.CacheSize(),
                                           cacheSet == null ? 0 : cacheSet.SlotSize());
            }

            return(strStatus);
        }
示例#2
0
        /// <summary>
        /// 子节点ID列表
        /// </summary>
        /// <returns></returns>
        public List <UInt32> GetChildIDList()
        {
            if (m_Children == null)
            {
                return(null);
            }
            List <UInt32> uKeyIDList = m_Children.KeyList();

            return(uKeyIDList);
        }
示例#3
0
        /// <summary>
        /// 收缩
        /// </summary>
        /// <returns></returns>
        public void Shrink(Int32 nMaxRemainCount)
        {
            if (nMaxRemainCount < 0)
            {
                nMaxRemainCount = 0;
            }
            if (m_Cache == null)
            {
                return;
            }
            List <string> keyList = m_Cache.KeyList();

            if (keyList == null)
            {
                return;
            }
            Int32 nKeySize = keyList.Count;

            for (Int32 i = 0; i < nKeySize; ++i)
            {
                string strCacheKey = keyList[i];
                Shrink(strCacheKey, nMaxRemainCount);
            }
        }