2014-09-02 18:07:02 +05:30
|
|
|
namespace :cache do
|
2015-09-11 14:41:01 +05:30
|
|
|
desc "GitLab | Clear redis cache"
|
2014-09-02 18:07:02 +05:30
|
|
|
task :clear => :environment do
|
|
|
|
# Hack into Rails.cache until https://github.com/redis-store/redis-store/pull/225
|
|
|
|
# is accepted (I hope) and we can update the redis-store gem.
|
|
|
|
redis_store = Rails.cache.instance_variable_get(:@data)
|
|
|
|
redis_store.keys.each_slice(1000) do |key_slice|
|
|
|
|
redis_store.del(*key_slice)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|