module Sequel::SchemaCaching

Public Instance Methods

dump_schema_cache(file) click to toggle source

Dump the cached schema to the filename given in Marshal format.

# File lib/sequel/extensions/schema_caching.rb, line 53
def dump_schema_cache(file)
  File.open(file, 'wb'){|f| f.write(Marshal.dump(@schemas))}
  nil
end
dump_schema_cache?(file) click to toggle source

Dump the cached schema to the filename given unless the file already exists.

# File lib/sequel/extensions/schema_caching.rb, line 60
def dump_schema_cache?(file)
  dump_schema_cache(file) unless File.exist?(file)
end
load_schema_cache(file) click to toggle source

Replace the schema cache with the data from the given file, which should be in Marshal format.

# File lib/sequel/extensions/schema_caching.rb, line 66
def load_schema_cache(file)
  @schemas = Marshal.load(File.read(file))
  nil
end
load_schema_cache?(file) click to toggle source

Replace the schema cache with the data from the given file if the file exists.

# File lib/sequel/extensions/schema_caching.rb, line 73
def load_schema_cache?(file)
  load_schema_cache(file) if File.exist?(file)
end