提交 cf669551 编写于 作者: J Jacob Vosmaer

Put CACHE_NAMESPACE in the Gitlab::Redis module

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册