The static_cache_cache plugin allows for caching the row content for subclasses that use the static cache plugin (or just the current class). Using this plugin can avoid the need to query the database every time loading the plugin into a model, which can save time when you have a lot of models using the static_cache plugin.
Usage:
# Make all model subclasses that use the static_cache plugin use # the cached values in the given file Sequel::Model.plugin :static_cache_cache, "static_cache.cache" # Make the AlbumType model the cached values in the given file, # should be loaded before the static_cache plugin AlbumType.plugin :static_cache_cache, "static_cache.cache"
Classes and Modules
Public Class methods
configure(model, file)
[show source]
# File lib/sequel/plugins/static_cache_cache.rb 21 def self.configure(model, file) 22 model.instance_variable_set(:@static_cache_cache_file, file) 23 model.instance_variable_set(:@static_cache_cache, File.exist?(file) ? Marshal.load(File.read(file)) : {}) 24 end