def cache_hits?(function, response, do_raise=:raise)
result = false
if caching?
function = function.to_sym
response_md5 = MD5.md5(response).to_s
unless @cache[function] && @cache[function][:response_md5] == response_md5
update_cache(function, {:response_md5 => response_md5,
:timestamp => Time.now,
:hits => 0,
:parsed => nil})
else
@cache[function][:hits] += 1
if do_raise == :raise
raise(AwsNoChange, "Cache hit: #{function} response has not changed since "+
"#{@cache[function][:timestamp].strftime('%Y-%m-%d %H:%M:%S')}, "+
"hits: #{@cache[function][:hits]}.")
else
result = @cache[function][:parsed] || true
end
end
end
result
end