Conform to ActiveSupport::Cache#delete's interface in Memcached::Rails.

This commit is contained in:
Vladimir Andrijevik 2010-03-03 05:18:18 +08:00 коммит произвёл Evan
Родитель 74ba887614
Коммит 5b4b808cd0
2 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -76,8 +76,8 @@ class Memcached
end end
# Wraps Memcached#delete so that it doesn't raise. # Wraps Memcached#delete so that it doesn't raise.
def delete(key) def delete(key, expiry=0)
super super(key)
rescue NotFound rescue NotFound
end end

Просмотреть файл

@ -41,6 +41,13 @@ class RailsTest < Test::Unit::TestCase
end end
end end
def test_delete_with_two_arguments
assert_nothing_raised do
@cache.delete(key, 5)
assert_nil(@cache.get(key))
end
end
def test_bracket_accessors def test_bracket_accessors
@cache[key] = @value @cache[key] = @value
result = @cache[key] result = @cache[key]