title: Does variable caching will be applied if I create an instance of the class from different worker?
body: <p>I have 2 workers and both workers are calling a factory who initialize the instance of a class and inside the initialize method I have used the variable caching so that both workers can take the advantage of variable caching while creating an instance of the class.</p>
  
  <pre><code>class BoxFolderDocumentSynchronizerJob &lt; ActiveJob::Base
    queue_as :default
  
    def perform(document_store_id, folder_id)
      synchronizer = DocumentSynchronizerFactory.get_synchronizer(document_store, folder_id)
    end
  end
  
  class DeleteBoxFolderDocumentJob &lt; ActiveJob::Base
    queue_as :default
  
    def perform(document_store_id, folder_id=nil)
      synchronizer = DocumentSynchronizerFactory.get_synchronizer(document_store, folder_id)
    end
  end
  
  module DocumentSynchronizers
    class Base
      attr_reader :document_store, :facility
  
      def initialize(document_store, folder_id=nil)
        if document_store
          @folder_id = folder_id
          @document_store  = document_store
          @facility = document_store.facility
          #Fetch all the document store(project) documents from S3/Box service provider
          @service_provider_documents_hash ||= DocumentStoreAdapterHandler.new(@document_store).list(folder_id)
          @vueops_documents_hashmap ||= @document_store.documents.inject({}){|hash, document| hash[document.file_id] = document; hash}
        else
          raise "Document store instance should not be nil"
        end
      end
    end
  end
  </code></pre>
  
  <p>My question is - when the variable caching scope ends?</p>