Sha256: e2cfde8274021d52c14b3c3230ab6a48e268c0a1ebe860066affe6076cb346b0
Contents?: true
Size: 760 Bytes
Versions: 2
Compression:
Stored size: 760 Bytes
Contents
# frozen_string_literal: true module Karafka # Module used to provide a persistent cache across batch requests for a given # topic and partition to store some additional details when the persistent mode # for a given topic is turned on module Persistence # @param topic [Karafka::Routing::Topic] topic instance for which we might cache # @param partition [Integer] number of partition for which we want to cache # @param resource [Symbol] name of the resource that we want to store def self.fetch(topic, partition, resource) return yield unless topic.persistent Thread.current[topic.id] ||= {} Thread.current[topic.id][partition] ||= {} Thread.current[topic.id][partition][resource] ||= yield end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
karafka-1.0.0 | lib/karafka/persistence.rb |
karafka-1.0.0.rc1 | lib/karafka/persistence.rb |