Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 7297d5f

Browse files
committed
Validate the cache when the view asks whether it's up to date
It's a good opportunity to validate the cache when the view asks whether there's more up to date data, otherwise views will never get updated data if the cache is invalid already.
1 parent 187662d commit 7297d5f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/GitHub.Api/Cache/CacheContainer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ public IManagedCache GetCache(CacheType cacheType)
5050
public void CheckAndRaiseEventsIfCacheNewer(CacheUpdateEvent cacheUpdateEvent)
5151
{
5252
var cache = GetCache(cacheUpdateEvent.cacheType);
53-
if (cache.LastUpdatedAt != cacheUpdateEvent.UpdatedTime)
53+
var needsInvalidation = cache.ValidateData();
54+
if (!needsInvalidation || cache.LastUpdatedAt != cacheUpdateEvent.UpdatedTime)
5455
{
5556
OnCacheUpdated(cache.CacheType, cache.LastUpdatedAt);
5657
}

0 commit comments

Comments
 (0)