public static Collection <ICollection <KeyValuePair <string, object> > > Get(MapperDb db, DbCommand command) { if (!db.CacheResults) { return(null); } string key = GetCacheKey(db, command); var item = MapperCache.GetCache <Collection <ICollection <KeyValuePair <string, object> > > >(key); return(item); }
public static void Set(MapperDb db, DbCommand command, Collection <ICollection <KeyValuePair <string, object> > > item) { if (!db.CacheResults) { return; } string key = GetCacheKey(db, command); var cacheDuration = db.CacheMilliseconds; var expiresOn = DateTimeOffset.UtcNow.AddMilliseconds(cacheDuration); MapperCache.AddToCache(key, item, expiresOn); }
public static List <PropertyInfo> GetProperties(Type item) { string key = item.FullName; var properties = MapperCache.GetCache <List <PropertyInfo> >(key); if (properties != null) { return(properties); } properties = item.GetProperties().Where(x => x.CanWrite).ToList(); MapperCache.AddToCache(key, properties); return(properties); }