Пример #1
0
        public void SetPopulationCount(Guid tileId, int population)
        {
            var client = new RedisClient();
            var key    = new PeopleKeys().GetPopulationKey(tileId);

            client.Set(key, population.ToString());
        }
Пример #2
0
 public int ReadPopulationCount(Guid tileId)
 {
     var client = new RedisClient();
     var key = new PeopleKeys ().GetPopulationKey (tileId);
     var value = client.Get (key);
     return Convert.ToInt32(value);
 }
Пример #3
0
        public void Delete(Guid personId)
        {
            var client = new RedisClient ();
            var key = new PeopleKeys ().GetPersonKey (personId);

            if (client.Exists (key))
                client.Del (key);
        }
Пример #4
0
        public int ReadPopulationCount(Guid tileId)
        {
            var client = new RedisClient();
            var key    = new PeopleKeys().GetPopulationKey(tileId);
            var value  = client.Get(key);

            return(Convert.ToInt32(value));
        }
Пример #5
0
        public void Save(Tile tile, Person[] people)
        {
            foreach (var person in people)
                Save (person);

            var client = new RedisClient();
            var key = new PeopleKeys ().GetPeopleKey (tile.Id);
            var json = ArrayToJson (people);
            client.Set(key, json);
        }
Пример #6
0
        public void Save(Person person)
        {
            var client = new RedisClient();
            var key = new PeopleKeys ().GetPersonKey (person.Id);
            var json = person.ToJson ();
            client.Set(key, json);

            var idManager = new DataIdManager ();
            idManager.Add (person);
        }
Пример #7
0
        public void Delete(Guid personId)
        {
            var client = new RedisClient();
            var key    = new PeopleKeys().GetPersonKey(personId);

            if (client.Exists(key))
            {
                client.Del(key);
            }
        }
Пример #8
0
        public void Save(Person person)
        {
            var client = new RedisClient();
            var key    = new PeopleKeys().GetPersonKey(person.Id);
            var json   = person.ToJson();

            client.Set(key, json);

            var idManager = new DataIdManager();

            idManager.Add(person);
        }
Пример #9
0
        public void Save(Tile tile, Person[] people)
        {
            foreach (var person in people)
            {
                Save(person);
            }

            var client = new RedisClient();
            var key    = new PeopleKeys().GetPeopleKey(tile.Id);
            var json   = ArrayToJson(people);

            client.Set(key, json);
        }
Пример #10
0
        public Person[] Read(Guid tileId)
        {
            var client = new RedisClient ();
            var key = new PeopleKeys ().GetPeopleKey (tileId);

            if (!client.Exists (key))
                return new Person[]{ };
            else {
                var json = client.Get (key);

                var people = JsonToArray<Person> (json);

                return people;
            }
        }
Пример #11
0
        public Person[] Read(Guid tileId)
        {
            var client = new RedisClient();
            var key    = new PeopleKeys().GetPeopleKey(tileId);

            if (!client.Exists(key))
            {
                return new Person[] { }
            }
            ;
            else
            {
                var json = client.Get(key);

                var people = JsonToArray <Person> (json);

                return(people);
            }
        }
Пример #12
0
 public void SetPopulationCount(Guid tileId, int population)
 {
     var client = new RedisClient();
     var key = new PeopleKeys ().GetPopulationKey (tileId);
     client.Set(key, population.ToString());
 }