Class: ActiveRecord::ConnectionAdapters::SpannerSchemaCache

Inherits:
SchemaCache
  • Object
show all
Defined in:
lib/active_record/connection_adapters/spanner/schema_cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(conn) ⇒ SpannerSchemaCache

Returns a new instance of SpannerSchemaCache.



10
11
12
13
# File 'lib/active_record/connection_adapters/spanner/schema_cache.rb', line 10

def initialize conn
  @primary_and_parent_keys = {}
  super
end

Instance Method Details

#clear!Object



37
38
39
40
# File 'lib/active_record/connection_adapters/spanner/schema_cache.rb', line 37

def clear!
  @primary_and_parent_keys.clear
  super
end

#encode_with(coder) ⇒ Object



20
21
22
23
# File 'lib/active_record/connection_adapters/spanner/schema_cache.rb', line 20

def encode_with coder
  coder["primary_and_parent_keys"] = @primary_and_parent_keys
  super
end

#init_with(coder) ⇒ Object



25
26
27
28
# File 'lib/active_record/connection_adapters/spanner/schema_cache.rb', line 25

def init_with coder
  @primary_and_parent_keys = coder["primary_and_parent_keys"]
  super
end

#initialize_dup(other) ⇒ Object



15
16
17
18
# File 'lib/active_record/connection_adapters/spanner/schema_cache.rb', line 15

def initialize_dup other
  @primary_and_parent_keys = @primary_and_parent_keys.dup
  super
end

#primary_and_parent_keys(table_name) ⇒ Object



30
31
32
33
34
35
# File 'lib/active_record/connection_adapters/spanner/schema_cache.rb', line 30

def primary_and_parent_keys table_name
  @primary_and_parent_keys[table_name] ||=
    if data_source_exists? table_name
      connection.primary_and_parent_keys table_name
    end
end