Appearance
Server-Side Caching
The server web app is holding a cache of recent queries in an Arc cache.
Every time a document is created/modified/deleted it is checked against the server side cache and updates them as necessary. Queries that are affected by a document change are evicted from the cache by default.
The detection logic can be found here:
ts
function isQueryInfluencedByDocument(newState, previousState, queryDefinition) {
const newStateDocumentIsIncludedInQuery = isDocumentInQuerySet(newState, queryDefinition)
if (newStateDocumentIsIncludedInQuery) {
return true
}
if (previousState) {
const oldStateDocumentIsIncludedInQuery = isDocumentInQuerySet(previousState, queryDefinition)
if (oldStateDocumentIsIncludedInQuery) {
return true
}
}
const isAnyDocumentInfluencedThroughAnAncestor = isDocumentAnAncestorInQuerySet(newState, queryDefinition)
if (isAnyDocumentInfluencedThroughAnAncestor) {
return true
}
return false
}
Note: It also checks the previous state of the document. So basically each cached query is checked against the previous state and the new state.