Esempio n. 1
0
 private static void SaveTo()
 {
     try
     {
         var client = RedisConnectionPool.Pop();
         try
         {
             byte[] data = ProtoBufUtils.Serialize(_globalSession);
             client.Set(sessionRedisKey, data);
         }
         finally
         {
             RedisConnectionPool.Put(client);
         }
     }
     catch (Exception er)
     {
         TraceLog.WriteError("Save session to redis faild,{0}", er);
     }
 }
Esempio n. 2
0
 private static void LoadUnLineData()
 {
     try
     {
         var client = RedisConnectionPool.Pop();
         try
         {
             byte[] data = client.Get <byte[]>(sessionRedisKey);
             var    temp = ProtoBufUtils.Deserialize <ConcurrentDictionary <Guid, GameSession> >(data);
             if (temp != null)
             {
                 _globalSession = temp;
             }
         }
         finally
         {
             RedisConnectionPool.Put(client);
         }
     }
     catch (Exception er)
     {
         TraceLog.WriteError("Load GameSession from redis faild,{0}", er);
     }
 }