diff --git a/lib/ansible/plugins/cache/redis.py b/lib/ansible/plugins/cache/redis.py index 230a9177cb..a8edaa6a04 100644 --- a/lib/ansible/plugins/cache/redis.py +++ b/lib/ansible/plugins/cache/redis.py @@ -116,7 +116,8 @@ class CacheModule(BaseCacheModule): return (self._db.zrank(self._keys_set, key) is not None) def delete(self, key): - del self._cache[key] + if key in self._cache: + del self._cache[key] self._db.delete(self._make_key(key)) self._db.zrem(self._keys_set, key)