Fix Redis script error, make TTL configurable