Class: Gitlab::Redis::Cache

Inherits:
Wrapper
  • Object
show all
Defined in:
lib/gitlab/redis/cache.rb

Constant Summary collapse

CACHE_NAMESPACE =
'cache:gitlab'
DEFAULT_REDIS_CACHE_URL =
'redis://localhost:6380'
REDIS_CACHE_CONFIG_ENV_VAR_NAME =
'GITLAB_REDIS_CACHE_CONFIG_FILE'

Constants inherited from Wrapper

Wrapper::DEFAULT_REDIS_URL, Wrapper::REDIS_CONFIG_ENV_VAR_NAME

Class Method Summary collapse

Methods inherited from Wrapper

_raw_config, config_file_path, #initialize, #params, pool, pool_size, #sentinels, #sentinels?, #url, with

Constructor Details

This class inherits a constructor from Gitlab::Redis::Wrapper

Class Method Details

.config_file_nameObject


18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gitlab/redis/cache.rb', line 18

def config_file_name
  # if ENV set for this class, use it even if it points to a file does not exist
  file_name = ENV[REDIS_CACHE_CONFIG_ENV_VAR_NAME]
  return file_name unless file_name.nil?

  # otherwise, if config files exists for this class, use it
  file_name = config_file_path('redis.cache.yml')
  return file_name if File.file?(file_name)

  # this will force use of DEFAULT_REDIS_QUEUES_URL when config file is absent
  super
end

.default_urlObject


14
15
16
# File 'lib/gitlab/redis/cache.rb', line 14

def default_url
  DEFAULT_REDIS_CACHE_URL
end

.instrumentation_classObject


31
32
33
# File 'lib/gitlab/redis/cache.rb', line 31

def instrumentation_class
  ::Gitlab::Instrumentation::Redis::Cache
end