/// <summary>
            /// Gets the type description for an instance.
            /// </summary>
            /// <param name="instance">Instance used to supply virtual cache type,
            /// if any. Ignored if <typeparamref name="T"/> doesn't implement
            /// <see cref="IVirtualCacheType"/> or <paramref name="virtualCacheObject"/>
            /// is not null.</param>
            /// <param name="virtualCacheObject">Object used to supply custom
            /// description. Ignored if <typeparamref name="T"/> doesn't implement
            /// <see cref="IVirtualCacheType"/>.</param>
            /// <returns>The <see cref="TypeDescription"/></returns>
            public static TypeDescription GetDescription(T instance,
                                                         IVirtualCacheType virtualCacheObject)
            {
                var description = Description;
                var typeName    = TypeName;

                if (IsVirtual)
                {
                    string cacheType = null;
                    if (virtualCacheObject != null)
                    {
                        cacheType = virtualCacheObject.CacheTypeName;
                    }
                    if (string.IsNullOrEmpty(cacheType) &&
                        (!_isReferenceType || instance != null))
                    {
                        cacheType = ((IVirtualCacheType)instance).CacheTypeName;
                    }
                    if (!string.IsNullOrEmpty(cacheType))
                    {
                        typeName    = cacheType;
                        description = _virtualDescriptions(cacheType);
                    }
                }
                AssertDescriptionFound(description, typeName);
                return(description);
            }
 private static DataBuffer GetKeySpace <T>(IVirtualCacheType virtualCacheObject)
     where T : ICacheParameter
 {
     return(virtualCacheObject != null?
            GetKeySpace(default(T), virtualCacheObject) :
                GetKeySpace <T>());
 }
        private static DateTime GetRefreshExpires <T>(T instance, IVirtualCacheType virtualCacheObject)
            where T : ICacheParameter
        {
            var ttl = TypeStatic <T> .GetDescription(instance, virtualCacheObject).Ttl;

            return(DateTime.Now.AddSeconds(ttl));
        }
 private static DataBuffer GetKeySpace <T>(T instance, IVirtualCacheType virtualCacheObject)
     where T : ICacheParameter
 {
     return(TypeStatic <T> .GetDescription(instance, virtualCacheObject).KeySpace);
 }