Skip to content

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.

Guides & Recipes — Caching

Recommended production patterns for multi-tier caching and trimming-safe JSON serialization.

Use short local L1 durations (e.g., 30 seconds) paired with longer distributed L2 Redis durations (e.g., 10 minutes) via HybridCacheEntryOptions.FromDurations(TimeSpan.FromSeconds(30), TimeSpan.FromMinutes(10)). Set failOpenOnRemoval: true only when transient L2 removal failures should not abort writes.

  • Use GetManyAsync<T>(keys, ct) and SetManyAsync<T>(entries, options, ct) to reduce round trips across Redis pipelines.
  • Tag related projections (e.g., ["catalog", $"category:{id}"]) and call RemoveByTagAsync("catalog", ct) on ITaggedCacheProvider instead of scanning prefixes on hot paths.

Instantiate new SystemTextJsonCacheSerializer(AppJsonContext.Default.Options) with your [JsonSerializable] context rather than SystemTextJsonCacheSerializer.Default so trimming does not remove required DTO metadata.