예제 #1
0
        public SubMapBinder GetSubMapBinder(long globalid)
        {
            AssertInitialized();

            using (var client = m_clientManager.GetClient())
            {
                IRedisHash <long, SubMapBinder> hash = client.As <SubMapBinder>().GetHash <long>(REDIS_KEY);

                if (!hash.ContainsKey(globalid))
                {
                    throw new Exception(string.Format("Submap {0} not found", globalid));
                }

                return(hash[globalid]);
            }
        }
예제 #2
0
        public SubMapBinder[] GetMapSubMapsBinder(int mapid)
        {
            AssertInitialized();

            using (IRedisClient client = m_clientManager.GetClient())
            {
                IRedisTypedClient <long[]> keysClient = client.As <long[]>();
                IRedisHash <int, long[]>   hash       = keysClient.GetHash <int>(REDIS_MAPS);

                if (!hash.ContainsKey(mapid))
                {
                    return(new SubMapBinder[0]);
                }

                long[] submaps      = hash[mapid];
                var    submapClient = (RedisTypedClient <SubMapBinder>)client.As <SubMapBinder>();

                return(submapClient.GetValuesFromHash(submapClient.GetHash <long>(REDIS_KEY), submaps).ToArray());
            }
        }