Sha256: 7230aaa49dd1ae409386262c32cb4342e17dc65011e82cfefd32a26285701d4b
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
require File.join(File.dirname(__FILE__), 'abstract_session_proxy') module Sunspot module SessionProxy # # This class implements a session proxy that creates a different Session # object for each thread. Any multithreaded application should use this # proxy. # class ThreadLocalSessionProxy < AbstractSessionProxy # The configuration with which the thread-local sessions are initialized. attr_reader :config delegate :batch, :commit, :commit_if_delete_dirty, :commit_if_dirty, :delete_dirty?, :dirty?, :index, :index!, :new_search, :remove, :remove!, :remove_all, :remove_all!, :remove_by_id, :remove_by_id!, :search, :to => :session # # Optionally pass an existing Sunspot::Configuration object. If none is # passed, a default configuration is used; it can then be modified using # the #config attribute. # def initialize(config = Sunspot::Configuration.new) @config = config end def session #:nodoc: Thread.current[:sunspot_session] ||= Session.new(config) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems