Commit cf669551 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Put CACHE_NAMESPACE in the Gitlab::Redis module

parent 3137f61a
......@@ -7,8 +7,6 @@ Bundler.require(:default, Rails.env)
require_relative '../lib/gitlab/redis'
module Gitlab
REDIS_CACHE_NAMESPACE = 'cache:gitlab'
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
......@@ -70,7 +68,7 @@ module Gitlab
end
redis_config_hash = Gitlab::Redis.redis_store_options
redis_config_hash[:namespace] = REDIS_CACHE_NAMESPACE
redis_config_hash[:namespace] = Gitlab::Redis::CACHE_NAMESPACE
redis_config_hash[:expires_in] = 2.weeks # Cache should not grow forever
config.cache_store = :redis_store, redis_config_hash
......
module Gitlab
class Redis
CACHE_NAMESPACE = 'cache:gitlab'
attr_reader :url
# To be thread-safe we must be careful when writing the class instance
......
......@@ -9,7 +9,7 @@ namespace :cache do
loop do
cursor, keys = redis.scan(
cursor,
match: "#{Gitlab::REDIS_CACHE_NAMESPACE}*",
match: "#{Gitlab::Redis::CACHE_NAMESPACE}*",
count: CLEAR_BATCH_SIZE
)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment