redis-py : What's the difference between StrictRedis() and Redis()?
I want using redis-py for caching some data. I can't find a suitable explain about difference between redis.StrictRedis() and redis.Redis() ! Is the Redis() equivalent to StrictRedis() ?
In addition, i can't find any clear documentation about redis.StrictRedis() arguments in Redis Python Docs Any idea?
redis-py exposes two client classes that implement these commands The StrictRedis class attempts to adhere to the official command syntax.
In addition to the changes above, the Redis class, a subclass of StrictRedis, overrides several other commands to provide backwards compatibility with older versions of redis-py
Do you need backwards compatibility? Use
Redis. Don't care? Use
Here are the specifics of the backwards compatibility, from the github.com link cited:
In addition to the changes above, the Redis class, a subclass of StrictRedis, overrides several other commands to provide backwards compatibility with older versions of redis-py:
LREM: Order of 'num' and 'value' arguments reversed such that 'num' can provide a default value of zero.
ZADD: Redis specifies the 'score' argument before 'value'. These were swapped accidentally when being implemented and not discovered until after people were already using it. The Redis class expects *args in the form of: name1, score1, name2, score2, ...
SETEX: Order of 'time' and 'value' arguments reversed.