Heya ![]()
I am a total noob with the new Hybrid Cache in .NET used in Umbraco 16.0.0 and I have some questions.
Firstly I watched Luke Hook from Gibe talk on the topic from CodeGarden to try and get me upto speed quickly and can recommend it ![]()
Recommended viewing 
Error
When I bootup the site I get the following error…
[11:53:38 FTL] An error occurred starting the application
System.AggregateException: One or more errors occurred. (One or more errors occurred. ('0x92' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.))
---> System.AggregateException: One or more errors occurred. ('0x92' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.)
---> System.Text.Json.JsonException: '0x92' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
---> System.Text.Json.JsonReaderException: '0x92' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first)
at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
at System.Text.Json.Utf8JsonReader.Read()
at System.Text.Json.JsonSerializer.GetReaderScopedToNextValue(Utf8JsonReader& reader, ReadStack& state)
--- End of inner exception stack trace ---
at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, JsonReaderException ex)
at System.Text.Json.JsonSerializer.GetReaderScopedToNextValue(Utf8JsonReader& reader, ReadStack& state)
at System.Text.Json.JsonSerializer.Read[TValue](Utf8JsonReader& reader, JsonTypeInfo`1 jsonTypeInfo)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultJsonSerializerFactory.DefaultJsonSerializer`1.Microsoft.Extensions.Caching.Hybrid.IHybridCacheSerializer<T>.Deserialize(ReadOnlySequence`1 source)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.MutableCacheItem`1.TryGetValue(ILogger log, T& value)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.CacheItem`1.GetReservedValue(ILogger log)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.StampedeState`2.<UnwrapReservedAsync>g__AwaitedAsync|18_0(ILogger log, Task`1 task)
at Umbraco.Cms.Infrastructure.HybridCache.Extensions.HybridCacheExtensions.TryGetValueAsync[T](HybridCache cache, String key)
at Umbraco.Cms.Infrastructure.HybridCache.Extensions.HybridCacheExtensions.ExistsAsync(HybridCache cache, String key)
at Umbraco.Cms.Infrastructure.HybridCache.Services.DocumentCacheService.SeedAsync(CancellationToken cancellationToken)
at Umbraco.Cms.Infrastructure.HybridCache.NotificationHandlers.SeedingNotificationHandler.HandleAsync(UmbracoApplicationStartedNotification notification, CancellationToken cancellationToken)
at Umbraco.Cms.Core.Events.INotificationAsyncHandler`1.HandleAsync(IEnumerable`1 notifications, CancellationToken cancellationToken)
at Umbraco.Cms.Core.Events.EventAggregator.PublishCoreAsync[TNotification](IEnumerable`1 allHandlers, IEnumerable`1 notifications, CancellationToken cancellationToken)
at Umbraco.Cms.Core.Events.NotificationAsyncHandlerWrapperImpl`1.HandleAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken, ServiceFactory serviceFactory, Func`4 publish)
at Umbraco.Cms.Core.Events.EventAggregator.PublishNotificationsAsync[TNotification,TNotificationHandler](IEnumerable`1 notifications, CancellationToken cancellationToken)
Project Setup
program.cs
...
// Hybrid Cache Adding in 2nd level cache (distributed cache) with Redis
// This is an example with a localhost docker instance to see/view entries
// Uses 'Microsoft.Extensions.Caching.StackExchangeRedis' nuget package
builder.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = builder.Configuration.GetConnectionString("RedisConnectionString");
});
...
Local Docker instance of Redis
docker run -d --name redis -p 6379:6379 redis:8.2
appsettings.json
{
...
"ConnectionStrings": {
"umbracoDbDSN": "Server=localhost;Database=someclientproject;Integrated Security=true;TrustServerCertificate=true;",
"umbracoDbDSN_ProviderName": "Microsoft.Data.SqlClient",
"RedisConnectionString": "127.0.0.1:6379"
},
"Umbraco": {
"CMS": {
"Cache": {
"ContentTypeKeys": [
"7d8c1806-ba81-4c12-a4b3-8558a7153824" // homepage doctype
],
"DocumentBreadthFirstSeedCount": 25, // default is 100
"DocumentSeedBatchSize": 100, // default is 100
}
...
}
}
}
Redis Insight Tool
Then I am using the Redis Insight tool to connect to the localhost instance to then try and see the entries that get put into the second level cache (as we can’t view anything stored in memory) as the 1st level cache.
When viewing it in Redis Insight tool I am getting weird symbols.
I was expecting to see the data stored against the cache item as a readable JSON format.
I have tried setting the view to JSON and MessagePack without luck.
Questions
- Should I even be able to view the data stored against the cache key item as a nice readable JSON format or is the way I am seeing it expected behaviour ?
- Is the FATAL error above a concern that I am going to have problems with my memory cache and distributed cache ?


