def test_clear_using_pattern(cache):
    'Remove items that match pattern from cache.'
    cache.set('matching_key', 'value')
    cache.set('another_matching_key', 'value')
    cache.set('key_not_matching', 'value')
    assert cache.keys()
    cache.clear(pattern='.*matching_key$')
    assert (cache.keys() == ['key_not_matching'])
Remove items that match pattern from cache.
def test_clear_using_pattern(cache):
    
    cache.set('matching_key', 'value')
    cache.set('another_matching_key', 'value')
    cache.set('key_not_matching', 'value')
    assert cache.keys()
    cache.clear(pattern='.*matching_key$')
    assert (cache.keys() == ['key_not_matching'])