Perform queries through network or local lookups.
In order to provide eventual consistency to users' data, the Virtual Cards SDK caches the results of each method call result to the Virtual Cards Service. This allows the ability to provide your users with real-time synchronization of data updates with the service.
For optimal behavior, cached results are best used to serve offline/fast data to the user while performing a background sync/update to deliver new information to the user.
Some access APIs offer the ability to provide a
CachePolicyproperty to determine the approach that is used to access the data. The two policies offered are
This policy will access the appropriate records directly from the Virtual Cards Service. When used as the selected cache policy, this will add and refresh new and existing records to the cache, as well as return the latest data set.
This policy will not call out to the Virtual Cards Service, but will instead use any existing cached result of previous API calls used with the
RemoteOnlypolicy. This policy comes with a caveat; queried results are cached 'as called'. This means that a cached query will only match a direct query result to the service (using
RemoteOnly). For instance, if a call is made to get all results using
RemoteOnly, and then a filter call is applied using
CacheOnly, all the same results from the previous call are returned. If wanting to filter the results, a filtered API call to the service will need to be performed first.