提交 4c0cb1c2 编写于 作者: G George Claghorn

Fix constant reference

Update the long key handling test so it triggers truncation in the Redis cache store.
上级 c2ba530c
......@@ -368,7 +368,7 @@ def normalize_key(key, options)
def truncate_key(key)
if key.bytesize > max_key_bytesize
suffix = ":sha2:#{Digest::SHA2.hexdigest(key)}"
suffix = ":sha2:#{::Digest::SHA2.hexdigest(key)}"
truncate_at = max_key_bytesize - suffix.bytesize
"#{key.byteslice(0, truncate_at)}#{suffix}"
else
......
......@@ -309,8 +309,7 @@ def test_crazy_key_characters
end
def test_really_long_keys
key = "".dup
900.times { key << "x" }
key = "x" * 2048
assert @cache.write(key, "bar")
assert_equal "bar", @cache.read(key)
assert_equal "bar", @cache.fetch(key)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册