public static IList <T> GetCachingObjects <T>(string routingName, int top, IFilterCondition[] where, IOrderByCondition[] orderby) where T : class, IAlbianObject { ICacheAttribute cache = GetCacheAttribute <T>(); if (null == cache || !cache.Enable) { return(null); } string cachedKey = Utils.GetCacheKey <T>(routingName, top, where, orderby); IExpiredCached cachedService = AlbianServiceRouter.GetService <IExpiredCached>(); if (null == cachedService) { if (null != Logger) { Logger.Warn("No expired cached service."); } return(null); } object oTarget = cachedService.Get(cachedKey); if (null == oTarget) { return(null); } return((IList <T>)oTarget); }
public static IList <T> GetCachingObjects <T>(IDbCommand cmd) where T : class, IAlbianObject { ICacheAttribute cache = GetCacheAttribute <T>(); if (null == cache || !cache.Enable) { return(null); } string cachedKey = Utils.GetCacheKey <T>(cmd); IExpiredCached cachedService = AlbianServiceRouter.GetService <IExpiredCached>(); if (null == cachedService) { if (null != Logger) { Logger.Warn("No expired cached service."); } return(null); } object oTarget = cachedService.Get(cachedKey); if (null == oTarget) { return(null); } return((IList <T>)oTarget); }
public static T GetCachingObject <T>(string routingName, IFilterCondition[] where) where T : class, IAlbianObject { ICacheAttribute cache = GetCacheAttribute <T>(); if (null == cache || !cache.Enable) { return(null); } string cachedKey = null != where && 1 == where.Length && "id" == where[0].PropertyName.ToLower() ? Utils.GetCacheKey <T>(where[0].Value.ToString(), AssemblyManager.GetFullTypeName <T>()) //find by pk id : Utils.GetCacheKey <T>(routingName, 0, where, null); IExpiredCached cachedService = AlbianServiceRouter.GetService <IExpiredCached>(); if (null == cachedService) { if (null != Logger) { Logger.Warn("No expired cached service."); } return(null); } object oTarget = cachedService.Get(cachedKey); if (null == oTarget) { return(null); } return((T)oTarget); }