Skip to content

Release 0.4.0#35

Merged
poxet merged 26 commits intomasterfrom
develop
Apr 6, 2026
Merged

Release 0.4.0#35
poxet merged 26 commits intomasterfrom
develop

Conversation

@poxet
Copy link
Copy Markdown
Contributor

@poxet poxet commented Apr 6, 2026

Summary

All Critical and Important backlog items resolved. New CI/CD pipeline. Major improvements to MongoDB integration and Blazor monitoring UI.

Bug fixes

  • AddCache idempotentAddCache() can now be called multiple times without throwing. AppendPreviousRegistrations skips duplicates, all DI registrations use TryAdd*. First registration wins. Fixes the crash when both Platform and Quilt4Net internally call AddCache.
  • MongoDB ClearCacheMongoDB.cs now subscribes to RequestEvictEvent, so ICacheMonitor.ClearAll() and ClearStale() properly evict MongoDB-persisted items (was missing the subscription that Memory, Redis, and File all had).
  • MongoDB default configMongoDBCacheOptions.ConfigurationName now defaults to "Default" instead of null, preventing NullReferenceException in CollectionFingerprint when no explicit config name is provided.
  • Cache info not displayed — Added Track<T> method to CacheMonitor that registers persisted items in the monitoring dictionary on first access. Items from MongoDB/Redis/File now appear in the Blazor UI immediately after app restart, not only after re-fetch. Works for all persistence backends.

New features

  • Fetch load duration trackingStopwatch wraps the fetch delegate in FetchQueue to measure load time. LoadDuration flows through CacheItemCacheMonitorCacheItemInfo. Blazor ListView shows a new "Load Time" column. Persisted in MongoDB CacheEntity; Redis/File get it free via JSON serialization.
  • GitHub Actions CI/CD — Build, test with coverage, CodeQL security analysis, NuGet publishing, and GitHub releases. Unified publish job with dynamic environment (release on master push, prerelease on PR). Version scheme: 0.4.x with auto-incrementing patch from git tags.
  • Deprecate IMemoryWithRedis — Use IRedis or IMemory explicitly instead.
  • ReturnDefaultOnFirstLoad option — Return default(T) on first cache miss instead of blocking; factory runs in the background.

Documentation

  • Root README rewritten with comprehensive usage docs covering all cache types, persistence backends, configuration, monitoring, events, and key building.
  • Per-project READMEs rewritten as concise NuGet sales pitches for Tharga.Cache, Redis, MongoDB, File, and Blazor packages.

Test plan

  • Verify CI pipeline runs (build + security jobs)
  • Approve release environment to publish 0.4.0 to NuGet
  • Verify packages appear on nuget.org
  • Verify GitHub release is created with correct version and notes

poxet and others added 26 commits March 27, 2026 14:02
Addresses two feature requests from Eplicta.Core:
1. Mark IMemoryWithRedis and MemoryWithRedis as [Obsolete] — consumers
   should use IRedis or IMemory explicitly instead.
2. Add ReturnDefaultOnFirstLoad option to CacheTypeOptions that returns
   default(T) immediately on first cache miss, running the factory in
   the background. Works independently of StaleWhileRevalidate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
AppendPreviousRegistrations now skips duplicate type registrations
instead of throwing. All DI service registrations use TryAdd* to
prevent duplicate entries. First registration wins when the same
type is registered across multiple AddCache calls.

Fixes the InvalidOperationException thrown when both Platform and
Quilt4Net internally call AddCache with overlapping type registrations.
MongoDB.cs was missing the RequestEvictEvent subscription that Memory,
Redis, and File all have. Without it, ICacheMonitor.ClearAll() and
ClearStale() never reached MongoDB-persisted items. Added
IManagedCacheMonitor to the constructor and wired up the same eviction
pattern used by the other persistence backends.
ConfigurationName was null by default, which caused NullReferenceException
in Tharga.MongoDB's CollectionFingerprint when the cache collection was
accessed. Now defaults to "Default" to match Tharga.MongoDB's
Constants.DefaultConfigurationName.
Added Track<T> method to CacheMonitor that registers items in the
monitoring dictionary without firing DataSetEvent. CacheBase.GetCoreAsync
now calls TrackIfNeeded when a fresh item is found from persistence,
making items from MongoDB/Redis/File visible in the Blazor UI immediately
on first access after app restart.
Stopwatch wraps the fetch delegate in FetchQueue to measure load time.
LoadDuration flows through CacheItem -> CacheMonitor -> CacheItemInfo.
Blazor ListView shows a "Load Time" column. Items loaded from persistence
(Track path) show null load duration. Removed TODO comment from
CacheItemInfo.
MongoDB was manually mapping CacheItem fields to CacheEntity, missing
LoadDuration. Redis and File serialize the full CacheItem via JSON so
they already preserved it. Now MongoDB stores and restores LoadDuration,
so load times survive app restarts.
Build job: restore, build, warning check (threshold 10), test with
coverage, codecov, compute version, pack 5 NuGet packages.
Security job: CodeQL analysis.
Publish job: unified job with dynamic environment — release on master
push, prerelease on PR. Pushes to NuGet and creates GitHub releases.
Version scheme: 0.4.x with auto-incrementing patch from git tags.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 6, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@poxet poxet merged commit 4f48316 into master Apr 6, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants