tests.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:django-redis-sentinel-redux 作者: danigosa 项目源码 文件源码
def test_clear_with_cache_prefix(self):
        """
        Tests that cache.clear() does only delete keys which starts with the
        correct prefix configured with KEY_PREFIX.
        """
        cache_normal = caches['sample']
        cache_with_prefix = caches['with_prefix']
        cache_normal.set('some_key', 'some_value')
        cache_with_prefix.set('other_key', 'other_value')

        cache_with_prefix.clear()

        self.assertIsNone(cache_with_prefix.get('other_key'))
        self.assertEqual(cache_normal.get('some_key'), 'some_value')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号