( sessionId: string, timeRange: ContactsTimeRangeState, factsCache: ContactsFactsCacheContext | null, dbVersion: string )
| 380 | } |
| 381 | |
| 382 | function readSessionFacts( |
| 383 | sessionId: string, |
| 384 | timeRange: ContactsTimeRangeState, |
| 385 | factsCache: ContactsFactsCacheContext | null, |
| 386 | dbVersion: string |
| 387 | ): ContactsSessionFacts | null { |
| 388 | if (!factsCache) return null |
| 389 | const cached = readCachedContactsSessionFacts( |
| 390 | sessionId, |
| 391 | factsCache.dir, |
| 392 | buildContactsSessionFactsCacheKey(CONTACTS_ALGORITHM_VERSION, timeRange), |
| 393 | dbVersion |
| 394 | ) |
| 395 | if (!cached.hit) { |
| 396 | factsCache.stats.factsMisses++ |
| 397 | return null |
| 398 | } |
| 399 | factsCache.stats.factsHits++ |
| 400 | return cached.data |
| 401 | } |
| 402 | |
| 403 | function writeSessionFacts( |
| 404 | adapter: SessionRuntimeAdapter, |
no test coverage detected