lib/cache_flow.rb in laserlemon-cache_flow-0.1.4 vs lib/cache_flow.rb in laserlemon-cache_flow-0.1.5
- old
+ new
@@ -89,20 +89,10 @@
end
def serialization_cache_key(extension, options)
query = options.except(:cache, :skip_instruct).reject{|k,v| v.nil? }.to_query
key = ["#{cache_key}.#{extension}", query].delete_if(&:blank?).join('?')
- if cache_key_limit && (key.size > cache_key_limit)
- "#{cache_key}.#{extension}?#{hashed_serialization_query(query)}"
- else
- key
- end
- end
-
- def cache_key_limit
- case Rails.cache.class.name.demodulize.underscore.to_sym
- when :mem_cache_store then 250
- end
+ key.size <= 250 ? key : "#{cache_key}.#{extension}?#{hashed_serialization_query(query)}"
end
def hashed_serialization_query(query)
require 'digest/sha1' unless defined?(Digest) && defined?(Digest::SHA1)
"cache_flow=#{Digest::SHA1.hexdigest(query)}"