instance method load_cache

Ruby on Rails 8.1.2

Since v7.1.6 Private

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

load_cache(pool)

No documentation comment.

Parameters

pool req
Source
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 116
        def load_cache(pool)
          # Can't load if schema dumps are disabled
          return unless possible_cache_available?

          # Check we can find one
          return unless new_cache = SchemaCache._load_from(@cache_path)

          if self.class.check_schema_cache_dump_version
            begin
              pool.with_connection do |connection|
                current_version = connection.schema_version

                if new_cache.version(connection) != current_version
                  warn "Ignoring #{@cache_path} because it has expired. The current schema version is #{current_version}, but the one in the schema cache file is #{new_cache.schema_version}."
                  return
                end
              end
            rescue ActiveRecordError => error
              warn "Failed to validate the schema cache because of #{error.class}: #{error.message}"
              return
            end
          end

          new_cache
        end

Defined in activerecord/lib/active_record/connection_adapters/schema_cache.rb line 116 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::SchemaReflection

Type at least 2 characters to search.

↑↓ navigate · open · esc close