Methods
- add
- cached?
- clear!
- clear_data_source_cache!
- columns
- columns_hash
- columns_hash?
- data_source_exists?
- data_sources
- dump_to
- indexes
- load!
- new
- primary_keys
- set_schema_cache
- size
- version
Attributes
[RW] | check_schema_cache_dump_version | |
[RW] | use_schema_cache_dump |
Class Public methods
new(cache_path, cache = nil)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 16
def initialize(cache_path, cache = nil)
@cache = cache
@cache_path = cache_path
end
🔎 See on GitHub
Instance Public methods
add(connection, name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 45
def add(connection, name)
cache(connection).add(connection, name)
end
🔎 See on GitHub
cached?(table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 87
def cached?(table_name)
if @cache.nil?
# If `check_schema_cache_dump_version` is enabled we can't load
# the schema cache dump without connecting to the database.
unless self.class.check_schema_cache_dump_version
@cache = load_cache(nil)
end
end
@cache&.cached?(table_name)
end
🔎 See on GitHub
clear!()
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 25
def clear!
@cache = empty_cache
nil
end
🔎 See on GitHub
clear_data_source_cache!(connection, name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 81
def clear_data_source_cache!(connection, name)
return if @cache.nil? && !possible_cache_available?
cache(connection).clear_data_source_cache!(connection, name)
end
🔎 See on GitHub
columns(connection, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 53
def columns(connection, table_name)
cache(connection).columns(connection, table_name)
end
🔎 See on GitHub
columns_hash(connection, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 57
def columns_hash(connection, table_name)
cache(connection).columns_hash(connection, table_name)
end
🔎 See on GitHub
columns_hash?(connection, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 61
def columns_hash?(connection, table_name)
cache(connection).columns_hash?(connection, table_name)
end
🔎 See on GitHub
data_source_exists?(connection, name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 41
def data_source_exists?(connection, name)
cache(connection).data_source_exists?(connection, name)
end
🔎 See on GitHub
data_sources(connection, name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 49
def data_sources(connection, name)
cache(connection).data_sources(connection, name)
end
🔎 See on GitHub
dump_to(connection, filename)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 99
def dump_to(connection, filename)
fresh_cache = empty_cache
fresh_cache.add_all(connection)
fresh_cache.dump_to(filename)
@cache = fresh_cache
end
🔎 See on GitHub
indexes(connection, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 65
def indexes(connection, table_name)
cache(connection).indexes(connection, table_name)
end
🔎 See on GitHub
load!(connection)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 31
def load!(connection)
cache(connection)
self
end
🔎 See on GitHub
primary_keys(connection, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 37
def primary_keys(connection, table_name)
cache(connection).primary_keys(connection, table_name)
end
🔎 See on GitHub
set_schema_cache(cache)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 21
def set_schema_cache(cache)
@cache = cache
end
🔎 See on GitHub
size(connection)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 77
def size(connection)
cache(connection).size
end
🔎 See on GitHub
version(connection)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 73
def version(connection)
cache(connection).version(connection)
end
🔎 See on GitHub