Problem Description
Today I encountered this error when using python's redis client: redis.exceptions.ResponseError: value is not an integer or out of range, which is a problem when using the setex function.

problem analysis
Obviously running well in my development environment, how to get to the test environment is a problem? Then try to read the redis client version of my development environment and test environment, one is 2.x, one is 3.x, the redis client of the test environment is newly installed, then the 3.x is unloaded Install a 2.x, then run ok, it seems to be a version difference. In the purpose of tracking the problem to the end, go to PyPI to find the update document of the redis client. Generally, the big difference in the use is the big version update, directly find the update file of 3.0, and see the following instructions. .

The general idea is that the 3.0 client has abandoned the Redis class and renamed the previous StrictRedis class to Redis. When using the SETEX method, the order of the parameters has changed (name, time, value), no longer the previous one (name , value, time), then what is the difference between the Redis class and the StrictRedis class? as follows:
StrictRedis: used to implement most official commands and use official syntax and commands (for example, the SET command corresponds to the StrictRedis.set method)
Redis: is a subclass of StrictRedis for backward compatibility with older versions of redis-py.
Simply put, the official recommendation to use the StrictRedis class, does not recommend the Redis class, because he and we are somewhat different in the redis-cli operation, the main difference is the following three aspects.
1, LREM: The order of the parameters 'num' and 'value' is exchanged, cli is lrem queueName 0 'string', where 0 means all, but Redis this class, the position of 0 and string is changed;
2, ZADD: The order of score and value was accidentally reversed when it was implemented. Later, it was used, and it was like this;
3. The order of SETEX:time and value is reversed.
Solution
So there are two solutions, the first one, modify the parameter order of the setex function according to the provisions of 3.x, the second, in exchange for 2.x, of course, the first method is recommended.