private void putCache(String key, CacheData cache) {
        synchronized (cacheMap) {
            Map<String, CacheData> copy = new HashMap<>(this.cacheMap.get());
            copy.put(key, cache);
            cacheMap.set(copy);
        }
    }
@Test
    void testPutCache() throws Exception {
        // 反射调用私有方法putCacheIfAbsent
        Method putCacheMethod = ClientWorker.class.getDeclaredMethod("putCache", String.class, CacheData.class);
        putCacheMethod.setAccessible(true);
        Properties prop = new Properties();
        ConfigFilterChainManager filter = new ConfigFilterChainManager(new Properties());
        ServerListManager agent = Mockito.mock(ServerListManager.class);
        final NacosClientProperties nacosClientProperties = NacosClientProperties.PROTOTYPE.derive(prop);
        ClientWorker clientWorker = new ClientWorker(filter, agent, nacosClientProperties);
        String key = "testKey";
        CacheData cacheData = new CacheData(filter, "env", "dataId", "group");
        putCacheMethod.invoke(clientWorker, key, cacheData);
        Field cacheMapField = ClientWorker.class.getDeclaredField("cacheMap");
        cacheMapField.setAccessible(true);
        AtomicReference<Map<String, CacheData>> cacheMapRef = (AtomicReference<Map<String, CacheData>>) cacheMapField.get(
                clientWorker);
        // 检查cacheMap是否包含特定的key
        assertNotNull(cacheMapRef.get().get(key));
        assertEquals(cacheData, cacheMapRef.get().get(key));
        // 测试再次插入相同的key将覆盖原始的值
        CacheData newCacheData = new CacheData(filter, "newEnv", "newDataId", "newGroup");
        putCacheMethod.invoke(clientWorker, key, newCacheData);
        // 检查key对应的value是否改变为newCacheData
        assertEquals(newCacheData, cacheMapRef.get().get(key));
    }