Skip to content

Commit

Permalink
Revert "Add logging on reads and writes to the cache."
Browse files Browse the repository at this point in the history
This reverts commit f811d7a.
  • Loading branch information
Vladimir Andrijevik committed Sep 10, 2009
1 parent f811d7a commit c894d2e
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions lib/zendesk/memflash.rb
Expand Up @@ -17,8 +17,6 @@ module InstanceMethods

if value.kind_of?(String) && value.length >= Zendesk::Memflash.threshold
value_for_hash = memflash_key(key)

log("MEMFLASH: Storing original message (#{value.length} characters) under key '#{value_for_hash}' in Rails.cache, and storing '#{value_for_hash}' in flash[:#{key}].")
Rails.cache.write(value_for_hash, value)
end

Expand All @@ -27,13 +25,7 @@ module InstanceMethods

define_method "[]_with_caching" do |key|
value_in_hash = send("[]_without_caching", key)

if memflashed?(key, value_in_hash)
log("MEMFLASH: flash[:#{key}] has been memflashed -- reading #{value_in_hash} from Rails.cache.")
Rails.cache.read(value_in_hash)
else
value_in_hash
end
memflashed?(key, value_in_hash) ? Rails.cache.read(value_in_hash) : value_in_hash
end

private
Expand All @@ -44,10 +36,6 @@ def memflash_key(hash_key)
def memflashed?(key, value)
!!(value =~ /^Memflash-#{key}/)
end

def log(message)
Rails.logger.info(message)
end
end # InstanceMethods
end # Memflash
end # Zendesk
Expand Down

0 comments on commit c894d2e

Please sign in to comment.