summaryrefslogtreecommitdiff
path: root/lib/gitlab/web_ide_commits_counter.rb
blob: 1cd9b5295b936fd74c0fb832a133211e78ee4bf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module Gitlab
  module WebIdeCommitsCounter
    WEB_IDE_COMMITS_KEY = "WEB_IDE_COMMITS_COUNT".freeze

    class << self
      def increment
        Gitlab::Redis::SharedState.with { |redis| redis.incr(WEB_IDE_COMMITS_KEY) }
      end

      def total_count
        Gitlab::Redis::SharedState.with { |redis| redis.get(WEB_IDE_COMMITS_KEY).to_i }
      end
    end
  end
end