Skip to content

Commit

Permalink
inject escape key method
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaltom committed Mar 9, 2012
1 parent cfaf2ac commit 65be11a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions config/initializers/extend_memcache.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# method copied from rails3 MemCacheStore
#

module ActiveSupport

class Cache::CompressedMemCacheStore
def escape_key(key)
key = key.to_s.gsub(/[\x00-\x20%\x7F-\xFF]/, '_')
key = "#{key[0, 213]}:md5:#{Digest::MD5.hexdigest(key)}" if key.size > 250
key
end
end
end

0 comments on commit 65be11a

Please sign in to comment.