Example #1
0
        public bool Recent(RPKey cache, string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                return(false);
            }

            return(m_cache.ContainsKey(cache) && m_cache[cache].Recent(key));
        }
Example #2
0
        public bool Exist(RPKey cache, string key, string secret)
        {
            if (string.IsNullOrEmpty(key))
            {
                return(false);
            }

            return(m_cache.ContainsKey(cache) && m_cache[cache].Exist(key, secret));
        }
Example #3
0
        public T Pop <T>(RPKey cache, string key) where T : Object
        {
            if (string.IsNullOrEmpty(key))
            {
                return(null);
            }

            T result = null;

            if (m_cache.ContainsKey(cache))
            {
                result = m_cache[cache].Pop <T>(key);
            }

            return(result);
        }
Example #4
0
        public void Push(RPKey cache, string key, string secret, bool recent, Object value)
        {
            if (string.IsNullOrEmpty(key))
            {
                return;
            }

            if (m_cache.ContainsKey(cache))
            {
                m_cache[cache].Push(key, secret, recent, value);
            }
            else
            {
                m_cache.Add(cache, new RPCache()
                {
                    capacity = Capacity(cache),
                });
                m_cache[cache].Push(key, secret, recent, value);
            }
        }
Example #5
0
        private int Capacity(RPKey cache)
        {
            switch (cache)
            {
            case RPKey.None:
                return(-1);

            case RPKey.ImageCover:
                return(3);

            case RPKey.ImageComment:
                return(3);

            case RPKey.AudioCover:
                return(3);

            case RPKey.AssetBundleNormal:
                return(-1);

            default:
                return(-1);
            }
        }
Example #6
0
 public void Release(RPKey cache, List <string> ignore, bool single = false)
 {
     foreach (var key in m_cache.Keys)
     {
         if (key == cache)
         {
             if (ignore != null && ignore.Count > 0)
             {
                 m_cache[key].Release(ignore);
             }
             else
             {
                 m_cache[key].Release();
             }
         }
         else
         {
             if (!single)
             {
                 m_cache[key].Release();
             }
         }
     }
 }