2019-07-16 09:12:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module UsageDataCounters
|
|
|
|
module RedisCounter
|
2019-07-17 19:45:35 -04:00
|
|
|
def increment(redis_counter_key)
|
2019-07-19 13:04:33 -04:00
|
|
|
return unless Gitlab::CurrentSettings.usage_ping_enabled
|
|
|
|
|
2019-07-16 09:12:37 -04:00
|
|
|
Gitlab::Redis::SharedState.with { |redis| redis.incr(redis_counter_key) }
|
|
|
|
end
|
|
|
|
|
2019-07-17 19:45:35 -04:00
|
|
|
def total_count(redis_counter_key)
|
2019-07-16 09:12:37 -04:00
|
|
|
Gitlab::Redis::SharedState.with { |redis| redis.get(redis_counter_key).to_i }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|