Module Sequel::IndexCaching
In: lib/sequel/extensions/index_caching.rb

Methods

Public Class methods

Set index cache to the empty hash.

[Source]

    # File lib/sequel/extensions/index_caching.rb, line 53
53:     def self.extended(db)
54:       db.instance_variable_set(:@indexes, {})
55:     end

Public Instance methods

Dump the index cache to the filename given in Marshal format.

[Source]

    # File lib/sequel/extensions/index_caching.rb, line 65
65:     def dump_index_cache(file)
66:       File.open(file, 'wb'){|f| f.write(Marshal.dump(@indexes))}
67:       nil
68:     end

Dump the index cache to the filename given unless the file already exists.

[Source]

    # File lib/sequel/extensions/index_caching.rb, line 72
72:     def dump_index_cache?(file)
73:       dump_index_cache(file) unless File.exist?(file)
74:     end

If no options are provided and there is cached index information for the table, return the cached information instead of querying the database.

[Source]

     # File lib/sequel/extensions/index_caching.rb, line 92
 92:     def indexes(table, opts=OPTS)
 93:       return super unless opts.empty?
 94: 
 95:       quoted_name = literal(table)
 96:       if v = Sequel.synchronize{@indexes[quoted_name]}
 97:         return v
 98:       end
 99: 
100:       result = super
101:       Sequel.synchronize{@indexes[quoted_name] = result}
102:       result
103:     end

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

[Source]

    # File lib/sequel/extensions/index_caching.rb, line 78
78:     def load_index_cache(file)
79:       @indexes = Marshal.load(File.read(file))
80:       nil
81:     end

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

[Source]

    # File lib/sequel/extensions/index_caching.rb, line 85
85:     def load_index_cache?(file)
86:       load_index_cache(file) if File.exist?(file)
87:     end

Remove the index cache for the given schema name

[Source]

    # File lib/sequel/extensions/index_caching.rb, line 58
58:     def remove_cached_schema(table)
59:       k = quote_schema_table(table)
60:       Sequel.synchronize{@indexes.delete(k)}
61:       super
62:     end

[Validate]