The hash_public_cache plugin builds on top of the hash_public plugin and adds the ability to store the digests for the public files in a json file, and load that file at startup, which avoids the need for the process to read the public file in order to compute the digest.
Examples:
# Load the plugin. Options given will be passed to public and hash_public. plugin :hash_public_cache, "path/to/cache_file.json" # When rebuilding the cache: # # * Scan the public directory for files, calculate the digest on each. # * Write the hash public cache to a file. # # This is split into separate steps in case you want to modify the cache # manually after the scan. scan_hash_public_cache_dir dump_hash_public_cache_file # To load the cache at application startup (if the file exists): load_hash_public_cache_file
Classes and Modules
Public Class methods
configure(app, cache_file, opts = OPTS)
Specify the location of the hash public cache file.
The options given are passed to the hash_public plugin.
[show source]
# File lib/roda/plugins/hash_public_cache.rb 38 def self.configure(app, cache_file, opts = OPTS) 39 app.opts[:hash_public_cache_file] = cache_file 40 end
load_dependencies(app, _cache_file, opts = OPTS)
[show source]
# File lib/roda/plugins/hash_public_cache.rb 31 def self.load_dependencies(app, _cache_file, opts = OPTS) 32 app.plugin :hash_public, opts 33 end