public void SetPopulationCount(Guid tileId, int population)
        {
            var client = new RedisClient();
            var key    = new PeopleKeys().GetPopulationKey(tileId);

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

            if (client.Exists (key))
                client.Del (key);
        }
        public int ReadPopulationCount(Guid tileId)
        {
            var client = new RedisClient();
            var key    = new PeopleKeys().GetPopulationKey(tileId);
            var value  = client.Get(key);

            return(Convert.ToInt32(value));
        }
Example #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);
        }
Example #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);
        }
Example #7
0
        public void Delete(Guid personId)
        {
            var client = new RedisClient();
            var key    = new PeopleKeys().GetPersonKey(personId);

            if (client.Exists(key))
            {
                client.Del(key);
            }
        }
Example #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);
        }
Example #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);
        }
Example #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;
            }
        }
Example #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);
            }
        }
Example #12
0
 public void SetPopulationCount(Guid tileId, int population)
 {
     var client = new RedisClient();
     var key = new PeopleKeys ().GetPopulationKey (tileId);
     client.Set(key, population.ToString());
 }