Example #1
0
        /// <summary>
        /// Sets the cache.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tarObject">The tar object.</param>
        protected void SetCache <T>(object tarObject) where T : class
        {
            var type = typeof(T);
            var xmlEntityCacheAttribute = XmlEntityUtility.GetXmlEntityCacheAttribute(type);

            if (null == xmlEntityCacheAttribute)
            {
                return;
            }
            //var id = typeof(T);
            var lifeCycle = xmlEntityCacheAttribute.LifeCycle;

            XmlEntityCacheWorker.Instance.Set(type, tarObject, lifeCycle);
        }
Example #2
0
        /// <summary>
        /// Determines whether the specified key has cache.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns><c>true</c> if the specified key has cache; otherwise, <c>false</c>.</returns>
        protected bool HasCache(Type key)
        {
            var xmlEntityCacheAttribute = XmlEntityUtility.GetXmlEntityCacheAttribute(key);

            return(null != xmlEntityCacheAttribute);
        }