module Mongoid::Sessions::Options::Threaded

Public Instance Methods

persistence_options(klass = self) click to toggle source

Get the persistence options for the current thread.

@example Get the persistence options.

Threaded.persistence_options(Band)

@param [ Class ] klass The model class.

@return [ Hash ] The current persistence options.

@since 4.0.0

# File lib/mongoid/sessions/options.rb, line 51
def persistence_options(klass = self)
  Thread.current["[mongoid][#{klass}]:persistence-options"]
end

Private Instance Methods

set_persistence_options(klass, options) click to toggle source

Set the persistence options on the current thread.

@api private

@example Set the persistence options.

Threaded.set_persistence_options(Band, { safe: { fsync: true }})

@param [ Class ] klass The model class. @param [ Hash ] options The persistence options.

@return [ Hash ] The persistence options.

@since 4.0.0

# File lib/mongoid/sessions/options.rb, line 69
def set_persistence_options(klass, options)
  Thread.current["[mongoid][#{klass}]:persistence-options"] = options
end