Welcome to mirror list, hosted at ThFree Co, Russian Federation.

hexdigest_cache_strategy.rb « pipeline « bulk_imports « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 51d7374f6c6dcff531a62382d6ba32dba9c8d36a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module BulkImports
  module Pipeline
    module HexdigestCacheStrategy
      def already_processed?(data, _)
        values = Gitlab::Cache::Import::Caching.values_from_set(cache_key)
        values.include?(OpenSSL::Digest::SHA256.hexdigest(data.to_s))
      end

      def save_processed_entry(data, _)
        Gitlab::Cache::Import::Caching.set_add(cache_key, OpenSSL::Digest::SHA256.hexdigest(data.to_s))
      end
    end
  end
end