Module | Sequel::SchemaCaching |
In: |
lib/sequel/extensions/schema_caching.rb
|
Dump the cached schema to the filename given in Marshal format.
# File lib/sequel/extensions/schema_caching.rb, line 53 53: def dump_schema_cache(file) 54: sch = {} 55: @schemas.each do |k,v| 56: sch[k] = v.map do |c, h| 57: h = Hash[h] 58: h.delete(:callable_default) 59: [c, h] 60: end 61: end 62: File.open(file, 'wb'){|f| f.write(Marshal.dump(sch))} 63: nil 64: end
Dump the cached schema to the filename given unless the file already exists.
# File lib/sequel/extensions/schema_caching.rb, line 68 68: def dump_schema_cache?(file) 69: dump_schema_cache(file) unless File.exist?(file) 70: end
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 74 74: def load_schema_cache(file) 75: @schemas = Marshal.load(File.read(file)) 76: @schemas.each_value{|v| schema_post_process(v)} 77: nil 78: end