From 391595429f71718c62c9f3e5a794d9054b45724a Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 24 Apr 2023 17:55:12 -0400 Subject: [PATCH] Stop storing two copies of attribute/event data in MTRDevice. (#26181) We have our own attribute value cache; we're just using ClusterStateCache to track DataVersions and event numbers. --- src/darwin/Framework/CHIP/MTRDevice.mm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index a43cd41bcb1de4..b9df4f0fdf40ab 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -569,14 +569,12 @@ - (void)_setupSubscription }); }); - // Set up a cluster state cache. We really just want this for the - // logic it has for tracking data versions and event numbers so we - // minimize the amount of data we request on resubscribes; we - // don't care about the data it stores. Ideally we could use the - // dataversion-management logic without needing to store the data - // separately from the data store we already have, or we would - // stop storing our data separately. - auto clusterStateCache = std::make_unique(*callback.get()); + // Set up a cluster state cache. We just want this for the logic it has for + // tracking data versions and event numbers so we minimize the amount of data we + // request on resubscribes, so tell it not to store data. + auto clusterStateCache = std::make_unique(*callback.get(), + /* highestReceivedEventNumber = */ NullOptional, + /* cacheData = */ false); auto readClient = std::make_unique(InteractionModelEngine::GetInstance(), exchangeManager, clusterStateCache->GetBufferedCallback(), ReadClient::InteractionType::Subscribe);