123456789_123456789_123456789_123456789_123456789_

Module: Mongo::QueryCache::Middleware::ActiveJob

Relationships & Source Files
Defined in: lib/mongo/query_cache.rb

Overview

ActiveJob middleware that activates the query cache for each job.

Class Method Summary

Class Method Details

.included(base)

[ GitHub ]

  
# File 'lib/mongo/query_cache.rb', line 286

def self.included(base)
  base.class_eval do
    around_perform do |_job, block|
      QueryCache.cache do
        block.call
      end
    ensure
      QueryCache.clear
    end
  end
end