public static T GetObjectFromByteArray <T>(this IDistributedCache cache, string key)
 {
     byte[] buf = cache.Get(key);
     if (buf == null || buf.Length == 0)
     {
         return(default(T));
     }
     return(PackUtility.UnPack <T>(buf));
 }
Exemple #2
0
        public static T GetObjectFromByteArray <T>(this ISession session, string key)
        {
            byte[] buf = null;

            bool s = session.TryGetValue(key, out buf);

            if (s)
            {
                return(PackUtility.UnPack <T>(buf));
            }
            return(default(T));
        }