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
- 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(pool, name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 41
def add(pool, name)
cache(pool).add(pool, name)
end
🔎 See on GitHub
cached?(table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 79
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 21
def clear!
@cache = empty_cache
nil
end
🔎 See on GitHub
clear_data_source_cache!(pool, name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 73
def clear_data_source_cache!(pool, name)
return if @cache.nil? && !possible_cache_available?
cache(pool).clear_data_source_cache!(pool, name)
end
🔎 See on GitHub
columns(pool, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 49
def columns(pool, table_name)
cache(pool).columns(pool, table_name)
end
🔎 See on GitHub
columns_hash(pool, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 53
def columns_hash(pool, table_name)
cache(pool).columns_hash(pool, table_name)
end
🔎 See on GitHub
columns_hash?(pool, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 57
def columns_hash?(pool, table_name)
cache(pool).columns_hash?(pool, table_name)
end
🔎 See on GitHub
data_source_exists?(pool, name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 37
def data_source_exists?(pool, name)
cache(pool).data_source_exists?(pool, name)
end
🔎 See on GitHub
data_sources(pool, name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 45
def data_sources(pool, name)
cache(pool).data_source_exists?(pool, name)
end
🔎 See on GitHub
dump_to(pool, filename)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 91
def dump_to(pool, filename)
fresh_cache = empty_cache
fresh_cache.add_all(pool)
fresh_cache.dump_to(filename)
@cache = fresh_cache
end
🔎 See on GitHub
indexes(pool, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 61
def indexes(pool, table_name)
cache(pool).indexes(pool, table_name)
end
🔎 See on GitHub
load!(pool)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 27
def load!(pool)
cache(pool)
self
end
🔎 See on GitHub
primary_keys(pool, table_name)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 33
def primary_keys(pool, table_name)
cache(pool).primary_keys(pool, table_name)
end
🔎 See on GitHub
size(pool)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 69
def size(pool)
cache(pool).size
end
🔎 See on GitHub
version(pool)
📝 Source code
# File activerecord/lib/active_record/connection_adapters/schema_cache.rb, line 65
def version(pool)
cache(pool).version(pool)
end
🔎 See on GitHub