Print a warning to STDERR if Redis version is less than 2.1.3

Prior to v2.1.3, any writes to keys with an expire/TTL set were
completely deleted before the write took place.
This commit is contained in:
2012-04-18 16:42:27 +01:00
parent c0ecf4bc84
commit 41f53b9fba

View File

@@ -4,6 +4,7 @@ module Redistat
module Connection
REQUIRED_SERVER_VERSION = "1.3.10"
MIN_EXPIRE_SERVER_VERSION = "2.1.3"
# TODO: Create a ConnectionPool instance object using Sychronize mixin to replace Connection class
@@ -67,6 +68,10 @@ module Redistat
def check_redis_version(conn)
raise RedisServerIsTooOld if conn.info["redis_version"] < REQUIRED_SERVER_VERSION
if conn.info["redis_version"] < MIN_EXPIRE_SERVER_VERSION
STDOUT.puts "WARNING: You MUST upgrade Redis to v2.1.3 or later " +
"if you are using key expiry."
end
conn
end