Example #1
0
        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);
        }
Example #2
0
        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);
        }