aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/cache.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-27 12:02:33 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-27 12:02:33 -0700
commit53265e88067084855753522256b86568fdad5b0c (patch)
treef6802cddd2971182a6035ed433adc16d5dc0c691 /actionpack/lib/action_dispatch/http/cache.rb
parent4e88f4f808d53074b3a8f85118c7eac059469809 (diff)
downloadrails-53265e88067084855753522256b86568fdad5b0c.tar.gz
rails-53265e88067084855753522256b86568fdad5b0c.tar.bz2
rails-53265e88067084855753522256b86568fdad5b0c.zip
remove `@etag` ivar
we're storing the value in the headers hash, so lets just store the value in one place.
Diffstat (limited to 'actionpack/lib/action_dispatch/http/cache.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/cache.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/http/cache.rb b/actionpack/lib/action_dispatch/http/cache.rb
index 8dc693c8ae..c6ea6d8e01 100644
--- a/actionpack/lib/action_dispatch/http/cache.rb
+++ b/actionpack/lib/action_dispatch/http/cache.rb
@@ -51,8 +51,7 @@ module ActionDispatch
end
module Response
- attr_reader :cache_control, :etag
- alias :etag? :etag
+ attr_reader :cache_control
def last_modified
if last = get_header(LAST_MODIFIED)
@@ -84,9 +83,13 @@ module ActionDispatch
def etag=(etag)
key = ActiveSupport::Cache.expand_cache_key(etag)
- @etag = %("#{Digest::MD5.hexdigest(key)}")
- set_header ETAG, @etag
+ set_header ETAG, %("#{Digest::MD5.hexdigest(key)}")
+ end
+
+ def etag
+ get_header ETAG
end
+ alias :etag? :etag
private
@@ -124,7 +127,6 @@ module ActionDispatch
def prepare_cache_control!
@cache_control = cache_control_headers
- @etag = get_header ETAG
end
def handle_conditional_get!