Ejemplo n.º 1
0
        public override bool Equals(object other)
        {
            QueryKey that = (QueryKey)other;

            if (!sqlQueryString.Equals(that.sqlQueryString))
            {
                return(false);
            }

            if (names == null)
            {
                if (that.names != null)
                {
                    return(false);
                }
            }
            else
            {
                if (that.names == null)
                {
                    return(false);
                }
                if (names.Length != that.names.Length)
                {
                    return(false);
                }

                for (int i = 0; i < names.Length; i++)
                {
                    if (!names[i].Equals(that.names[i]))
                    {
                        return(false);
                    }
                    if (!Equals(values[i], that.values[i]))
                    {
                        return(false);
                    }
                }
            }

            if (!CollectionHelper.DictionaryEquals(namedParameters, that.namedParameters))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public bool Put(QueryKey key, object result, long ts)
        {
            if (result == null)
            {
                return(false);
            }

            if (log.IsDebugEnabled)
            {
                log.DebugFormat("caching query results : '{0}'", key);
            }

            IList cacheable = new List <object>(2)
            {
                ts
            };

            cacheable.Add(result);

            queryCache.Put(key, cacheable);
            return(true);
        }