Sha256: 08cd52b716b755ca2f256c08855ffc2ebcbc5a6efb876dd76ea805a9356bbe1e

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

module Owl

  module CMS
    module Cache  
      extend Sinatra::Extension

      CACHE_ROOT        = "#{Dir.pwd}"
      CACHE_PATH        = ".cache"
      CACHE_STORE       = File.join(CACHE_ROOT, CACHE_PATH)
      METASTORE_URI     = "file:#{CACHE_STORE}"
      ENTITYSTORE_URI   = "file:#{CACHE_STORE}"

      use Rack::Cache do
        set :verbose,     true
        set :metastore,   METASTORE_URI
        set :entitystore, ENTITYSTORE_URI
      end

      use Rack::FunkyCache, :root => CACHE_ROOT, :path => CACHE_PATH

      before do

        if env['HTTP_PRAGMA'] != 'no-cache'
          file = Owl::Lib::CachedFile.find(request)
          if file
            last_modified File.mtime(file)
            send_file(file)
          end
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
owl-cms-0.1.3 core/routes/cache.rb
owl-cms-0.1.2 core/routes/cache.rb
owl-cms-0.1.1 core/routes/cache.rb
owl-cms-0.1.0 core/routes/cache.rb