Sha256: b4cac08b57672373e8c91791b30734cb159217dd410db2f54f1d0fe04a643b11
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
module Owl module CMS module Cache extend Sinatra::Extension CACHE_ROOT = "#{Dir.pwd}" CACHE_PATH = ".cache" CACHE_STORE = File.expand_path File.join(CACHE_ROOT, CACHE_PATH) METASTORE_URI = "file:#{CACHE_STORE}" ENTITYSTORE_URI = "file:#{CACHE_STORE}" CACHE_BLACKLIST = [ /^\/cache/, /^\/admin/ ] use Rack::Cache, verbose: false, metastore: METASTORE_URI, entitystore: ENTITYSTORE_URI use Rack::FunkyCache, root: CACHE_ROOT, path: CACHE_PATH before do file = Owl::Lib::CachedFile.find(request) if file if (env['HTTP_PRAGMA'] == 'no-cache') or request.path.match Regexp.new(CACHE_BLACKLIST.join("|")) # don't send cached file. else last_modified File.mtime(file) send_file(file) end end end get '/cache/clear' do Owl::Lib::CachedFile.clear_all! "You have cleared the cache." end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
owl-cms-0.1.5 | core/routes/cache.rb |