Method: ActiveSupport::Cache::RedisCacheStore#clear

Defined in:
activesupport/lib/active_support/cache/redis_cache_store.rb

#clear(options = nil) ⇒ Object

Clear the entire cache on all Redis servers. Safe to use on shared servers if the cache is namespaced.

Failsafe: Raises errors.



309
310
311
312
313
314
315
316
317
# File 'activesupport/lib/active_support/cache/redis_cache_store.rb', line 309

def clear(options = nil)
  failsafe :clear do
    if namespace = merged_options(options)[:namespace]
      delete_matched "*", namespace: namespace
    else
      redis.then { |c| c.flushdb }
    end
  end
end