Exemple #1
0
        /// <summary>
        /// Caches the read.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="asDictionaryKey">if set to <c>true</c> [as dictionary key].</param>
        /// <param name="p">The p.</param>
        /// <returns></returns>
        public object CacheRead(string s, bool asDictionaryKey, AbstractParser p)
        {
            if (s.Length != 0)
            {
                if (CacheCode(s))
                {
                    return(cache[CodeToIndex(s)]);
                }
                else if (WriteCache.IsCacheable(s, asDictionaryKey))
                {
                    if (index == WriteCache.MaxCacheEntries)
                    {
                        Init();
                    }
                    return(cache[index++] = (p != null ? p.ParseString(s) : s));
                }
            }

            return(p != null?p.ParseString(s) : s);
        }
        /// <summary>
        /// Caches the read.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="asDictionaryKey">if set to <c>true</c> [as dictionary key].</param>
        /// <param name="p">The p.</param>
        /// <returns></returns>
        public object CacheRead(string s, bool asDictionaryKey, AbstractParser p)
        {
            if (s.Length != 0)
            {
                if (CacheCode(s))
                {
                    return cache[CodeToIndex(s)];
                }
                else if (WriteCache.IsCacheable(s, asDictionaryKey))
                {
                    if (index == WriteCache.MaxCacheEntries)
                    {
                        Init();
                    }
                    return cache[index++] = (p != null ? p.ParseString(s) : s);
                }
            }

            return p != null ? p.ParseString(s) : s;
        }