Exemple #1
0
        /// <summary>
        /// Get cached object
        /// </summary>
        /// <param name="ctx">context (only used when the cached object is a PO - otherwise ignored)</param>
        /// <param name="key">the key value</param>
        /// <returns>cached value or if PO and ctx provided, the clone of a PO</returns>
        /// <date>07-march-2011</date>
        /// <writer>Raghu</writer>
        public V Get(Ctx ctx, K key)
        {
            Expire();
            //V v = m_cache.get(key);

            V v = default(V);

            if (cacheDic.Count > 0)
            {
                v = cacheDic[key];
            }

            if ((ctx != null) && (v is PO))
            {
                PO b  = (PO)Convert.ChangeType(v, typeof(V));
                PO b1 = PO.Copy(ctx, b, null);
                return((V)Convert.ChangeType(b1, typeof(V)));;
            }
            return(v);
        }