def test_cache_clear(self):
        """Test the clear method for both cache types."""
        for cache_type, cache in self.caches.items():
            with self.subTest(cache_type=cache_type):
                cache.set('key1', 'value1')
                cache.set('key2', 'value2')
                cache.clear()
                self.assertEqual(len(cache), 0, f"{cache_type} cache did not clear.")
                self.assertEqual(cache.currsize, 0, f"{cache_type} cache did not clear currsize.")
                self.assertEqual(cache.maxsize, 2, f"{cache_type} cache maxsize changed after clear.")
Test the clear method for both cache types.
tests/integ_tests/core/inference/test_cache.py