def test_cache_Concurrency(self):
        """Test that the cache handles concurrent access correctly for both cache types."""
        for cache_type, cache in self.caches.items():
            with self.subTest(cache_type=cache_type):
                import threading

                def set_items():
                    for i in range(10):
                        cache.set(f'key{i}', f'value{i}')

                def get_items():
                    for i in range(10):
                        value = cache.get(f'key{i}', None)

                threads = []
                for _ in range(5):
                    t1 = threading.Thread(target=set_items)
                    t2 = threading.Thread(target=get_items)
                    t1.start()
                    t2.start()
                    threads.extend([t1, t2])

                for t in threads:
                    t.join()

                self.assertEqual(len(cache), 2, f"{cache_type} cache size does not match after concurrent access.")
Test that the cache handles concurrent access correctly for both cache types.
tests/integ_tests/core/inference/test_cache.py