Does cache expire in on interaction cache mode?

556
3
10-08-2020 09:53 AM
BrianKeller
New Contributor II

Hi,

Using 100.7. Scenario is user views a map extent with on interaction cache mode and then someone else deletes a feature that is in that extent. We are seeing that features which are deleted by someone else stay cached locally and visible long after the features are gone. I'm testing this scenario right now, going on about 17 hours after the feature was deleted. Newly added features or features which are moved -- those changes get picked up immediately upon slight change of the extent, but deleted features stay. Is this the expected behavior?  Even identifying on that feature and the service responding that it doesn't exist doesn't remove it. Moving the map entirely somewhere else and coming back also doesn't refresh it.

Just curious if this deleted feature is expected to remain indefinitely in this "on interaction cache" mode? In order to clear it would the user have to restart the application or the code would have to manually clear the cache? I think our expectation was that the cache would expire at some point.

If I would adjust the cachePolicy - Enums.NetworkCachePolicy, would this change this behavior? I realize this via QML is accessible only from 100.8, which is why I haven't tried it.

Thanks!

0 Kudos
3 Replies
JamesBallard1
Esri Regular Contributor

Hi Brian Keller‌,

   Unfortunately these are the limitations of Enums.FeatureRequestModeOnInteractionCache mode. It is optimized to reduce network bandwidth. If it is important to always have the latest data you should use Enums.FeatureRequestModeOnInteractionNoCache instead.

We don't have any public info or guarantees about the details of the local cache when working in OnInteractionCache mode.

An alternate approach would be to use Enums.FeatureRequestModeManualCache mode and call populateFromService on some regular interval. This might be better for your workflow if using NoCache mode uses too much bandwidth.

Regarding the cacheMode, I don't think that will make any difference to this workflow. Using the default setting should reduce overall network bandwidth for requests that don't change. That might reduce overall bandwidth with NoCache or ManualCache modes when no changes are required.

0 Kudos
JamesBallard1
Esri Regular Contributor

Brian Keller‌ another option is to use the refreshInterval on the FeatureLayer.

FeatureLayer QML Type | ArcGIS for Developers 

0 Kudos
BrianKeller
New Contributor II

James Ballard‌, refreshInterval looks to be a good option for clearing out these stale features. Tested it and it works well. Now just have to find the right interval. I think using this would be sufficient and we don't have to go all the way to Enums.FeatureRequestModeOnInteractionNoCache, but I will play with it. Thanks!