Exemple #1
0
        /// <summary>
        /// 저장된 아이템의 사용 횟수를 반환합니다. (key-사용횟수)
        /// </summary>
        /// <param name="sharedCacke"></param>
        /// <param name="keyPredicate">key filter</param>
        /// <param name="usagePredicate">usage filter (예: x=> x>0)</param>
        /// <returns></returns>
        public static IEnumerable <KeyValuePair <string, long> > ItemUsageList(this IndexusProviderBase sharedCacke,
                                                                               Func <string, bool> keyPredicate = null,
                                                                               Func <long, bool> usagePredicate = null)
        {
            var usageList = sharedCacke.GetStats().ServiceUsageList;

            if (usageList == null || usageList.Count == 0)
            {
                return(Enumerable.Empty <KeyValuePair <string, long> >());
            }

            var query = usageList.AsEnumerable();

            if (keyPredicate != null)
            {
                query = query.Where(x => keyPredicate(x.Key));
            }

            if (usagePredicate != null)
            {
                query = query.Where(x => usagePredicate(x.Value));
            }

            return(query);
        }
Exemple #2
0
 /// <summary>
 /// 캐시 서버의 요소가 차지하는 총 크기 (byte 단위)
 /// </summary>
 /// <param name="sharedCache"></param>
 /// <param name="serverName"></param>
 /// <returns></returns>
 public static long TotalSize(this IndexusProviderBase sharedCache, string serverName = null)
 {
     return(serverName.IsWhiteSpace()
                ? sharedCache.GetStats().ServiceTotalSize
                : sharedCache.GetStats(serverName).ServiceTotalSize);
 }
Exemple #3
0
 /// <summary>
 /// 캐시된 요소의 갯수
 /// </summary>
 /// <param name="sharedCache"></param>
 /// <param name="serverName"></param>
 /// <returns></returns>
 public static long ItemCount(this IndexusProviderBase sharedCache, string serverName = null)
 {
     return(serverName.IsWhiteSpace()
                ? sharedCache.GetStats().ServiceAmountOfObjects
                : sharedCache.GetStats(serverName).ServiceAmountOfObjects);
 }