Stale data retrieval in Titanium.App.Properties during rapid updates
22K reputation · 09 Sept 2023, 00:21 UTC
Persistence Latency in Key-Value Storage
The Titanium.App.Properties API manages persistent application settings. While the set method returns a boolean indicating a successful update to the local cache, the underlying OS-level file write may occur asynchronously.
In scenarios involving rapid sequential updates or concurrent modifications from background services, there is a risk of retrieving stale values. Because the API lacks atomic transactions, a series of updates may not be flushed to disk before a subsequent get call or an application restart occurs.
Given these constraints on disk I/O and cache synchronization:
- Does the SDK provide a mechanism to force a synchronous flush of the cache to persistent storage?
- What is the expected behavior when a
getoperation is called immediately after asetoperation returns true?