Method: Spider::Model::Storage::BaseStorage#curr

Defined in:
lib/spiderfw/model/storage/base_storage.rb

#currHash

Returns An hash of thread-local values for this connection.

Returns:

  • (Hash)

    An hash of thread-local values for this connection



151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/spiderfw/model/storage/base_storage.rb', line 151

def curr
    var = nil
    if Spider.conf.get('storage.shared_connection')
        $STORAGES ||= {}
        var = $STORAGES
    else
        var = Thread.current
    end
    var[:storages] ||= {}
    var[:storages][self.class.storage_type] ||= {}
    var[:storages][self.class.storage_type][@connection_params] ||= {
        :transaction_nesting => 0, :savepoints => []
    }
end