Public Instance methods
dump_schema_cache(file)
Dump the cached schema to the filename given in Marshal format.
[show source]
# File lib/sequel/extensions/schema_caching.rb 53 def dump_schema_cache(file) 54 sch = {} 55 @schemas.sort.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_schema_cache?(file)
Dump the cached schema to the filename given unless the file already exists.
[show source]
# File lib/sequel/extensions/schema_caching.rb 68 def dump_schema_cache?(file) 69 dump_schema_cache(file) unless File.exist?(file) 70 end
load_schema_cache(file)
Replace the schema cache with the data from the given file, which should be in Marshal format.
[show source]
# File lib/sequel/extensions/schema_caching.rb 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
load_schema_cache?(file)
Replace the schema cache with the data from the given file if the file exists.
[show source]
# File lib/sequel/extensions/schema_caching.rb 82 def load_schema_cache?(file) 83 load_schema_cache(file) if File.exist?(file) 84 end