Exemplo n.º 1
0
        public bool add_cache(object _key, object _value)
        {
            if ((_key == null) || (_value == null))
            {
                return(false);
            }
            CachedObjectInfo cache_info = get_cache_info(_key);

            if (cache_info == null)
            {
                cache_info = add_cache_info(_key);
                if (cache_info == null)
                {
                    return(false);
                }
            }
            if (cache_info.cached_obj(_value.GetHashCode()))
            {
                cache_info.add_to_cache(_value);
                return(true);
            }
            if (get_cache_count() >= cache_block_max_count_)
            {
                try_fix_pool();
            }
            if (get_cache_count() > cache_block_max_count_)
            {
                return(false);
            }
            cache_info.add_to_cache(_value);
            return(true);
        }