Permalink
Browse files

cache content_type with response_buffer

  • Loading branch information...
1 parent 0affca0 commit 86a604bc2c1b5d059e7502cd8edcc29b991942e8 @blakedy committed Dec 24, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 padrino-cache/lib/padrino-cache/helpers/page.rb
@@ -93,18 +93,18 @@ def self.padrino_route_added(route, verb, path, args, options, block) # @private
began_at = Time.now
value = settings.cache.get(@route.cache_key || env['PATH_INFO'])
logger.debug "GET Cache", began_at, @route.cache_key || env['PATH_INFO'] if defined?(logger) && value
- halt 200, value if value
+ halt 200, {'Content-Type' => mime_type(value[:content_type])}, value[:response_buffer] if value
end
end
route.after_filters do
if settings.caching?
began_at = Time.now
if @_last_expires_in
- settings.cache.set(@route.cache_key || env['PATH_INFO'], @_response_buffer, :expires_in => @_last_expires_in)
+ settings.cache.set(@route.cache_key || env['PATH_INFO'], {:response_buffer => @_response_buffer, :content_type => @_content_type}, :expires_in => @_last_expires_in)
@_last_expires_in = nil
else
- settings.cache.set(@route.cache_key || env['PATH_INFO'], @_response_buffer)
+ settings.cache.set(@route.cache_key || env['PATH_INFO'], {:response_buffer => @_response_buffer, :content_type => @_content_type})
end
logger.debug "SET Cache", began_at, @route.cache_key || env['PATH_INFO'] if defined?(logger)
end

0 comments on commit 86a604b

Please sign in to comment.