Add support for one-step increments to the Redis engine. #29
I.e. in the same way we added support for the MySQL engine in #23 but for the Redis engine.
In the current way the records are encoded in the Redis engine, one-step increments are not possible. We'll need to change the records from string to hashes, and also provide a way to migrate the database.
The existing migration script can be used. A simple check should be performed when starting the pyzord server looking for a "version" entry in the database and checking if it matches the current implementation. If not then a error message should be displayed with instructions on migrating the database.
The text was updated successfully, but these errors were encountered:
Deprecate the old version of string encoding record in favour of using hashes. Check for deprecated records when the engine is created and display warnings for the user. Add ability to delete old records to the pyzor-migrate script, in order to get rid of the warning. Use hincrby when incrementing reports and whitelists counts, instead of replacing the whole record. Make sure to set propper expiry if necessary. Old version will still be available under the `redis_v0` name.
- Use `hincrby` even if the key doesn't exists yet. Redis automatically creates it and sets it to 1. - Use `hsetnx` to set the entered date, this only sets it the key doesn't exists. - And use `hset` to always set the updated date. - Change the decode method to expect some keys to be missing from the hash.