fix issue with ttl with memcached and redis, refactor tests