diff --git a/lib/memcached/rails.rb b/lib/memcached/rails.rb index f931674..9681cda 100644 --- a/lib/memcached/rails.rb +++ b/lib/memcached/rails.rb @@ -76,8 +76,8 @@ class Memcached end # Wraps Memcached#delete so that it doesn't raise. - def delete(key) - super + def delete(key, expiry=0) + super(key) rescue NotFound end diff --git a/test/unit/rails_test.rb b/test/unit/rails_test.rb index 6bebf86..20b1812 100644 --- a/test/unit/rails_test.rb +++ b/test/unit/rails_test.rb @@ -41,6 +41,13 @@ class RailsTest < Test::Unit::TestCase 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 @cache[key] = @value result = @cache[key]