Hybrid Cache: Resolve start-up errors with mis-matched types (#20554)
* Be consistent in use of GetOrCreateAsync overload in exists and retrieval. Ensure nullability of ContentCacheNode is consistent in exists and retrieval. * Applied suggestion from code review. * Move seeding to Umbraco application starting rather than started, ensuring an initial request is served. * Tighten up hybrid cache exists check with locking around check and remove, and use of cancellation token.
This commit is contained in:
@@ -205,7 +205,7 @@ internal sealed class DocumentCacheService : IDocumentCacheService
|
||||
|
||||
var cacheKey = GetCacheKey(key, false);
|
||||
|
||||
var existsInCache = await _hybridCache.ExistsAsync<ContentCacheNode>(cacheKey);
|
||||
var existsInCache = await _hybridCache.ExistsAsync<ContentCacheNode?>(cacheKey, cancellationToken).ConfigureAwait(false);
|
||||
if (existsInCache is false)
|
||||
{
|
||||
uncachedKeys.Add(key);
|
||||
@@ -278,7 +278,7 @@ internal sealed class DocumentCacheService : IDocumentCacheService
|
||||
return false;
|
||||
}
|
||||
|
||||
return await _hybridCache.ExistsAsync<ContentCacheNode>(GetCacheKey(keyAttempt.Result, preview));
|
||||
return await _hybridCache.ExistsAsync<ContentCacheNode?>(GetCacheKey(keyAttempt.Result, preview), CancellationToken.None);
|
||||
}
|
||||
|
||||
public async Task RefreshContentAsync(IContent content)
|
||||
|
||||
Reference in New Issue
Block a user