Skip to content

Performance: Optimize refresh of hybrid cache for a document by retrieving draft and published in single query - #21407

Merged
nikolajlauridsen merged 3 commits into
mainfrom
v17/improvement/optimize-get-content-source-2
Jan 15, 2026
Merged

Performance: Optimize refresh of hybrid cache for a document by retrieving draft and published in single query#21407
nikolajlauridsen merged 3 commits into
mainfrom
v17/improvement/optimize-get-content-source-2

Use is null for consistency

69eb551
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Code Health Review (main) failed Jan 15, 2026 in 40s

CodeScene PR Check

Quality Gate Failed

Gates Failed
Enforce advisory code health rules (2 files with Primitive Obsession, Large Method)

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Reason for failure
Enforce advisory code health rules Violations Code Health Impact
DatabaseCacheRepository.cs 1 advisory rule 7.04 → 6.83 Suppress
DocumentHybridCacheMockTests.cs 1 advisory rule 9.01 → 9.00 Suppress

Quality Gate Profile: Clean Code Collective
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.

Details

🚩 Declining Code Health (highest to lowest):

  • Large Method DocumentHybridCacheMockTests.cs: SetUp
  • Primitive Obsession DatabaseCacheRepository.cs

✅ Improving Code Health:

  • Code Duplication DatabaseCacheRepository.cs: GetContentSourceAsync

Annotations

Check notice on line 1 in src/Umbraco.PublishedCache.HybridCache/Persistence/DatabaseCacheRepository.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

✅ Getting better: Code Duplication

reduced similar code in: GetContentSourceAsync. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 1 in src/Umbraco.PublishedCache.HybridCache/Persistence/DatabaseCacheRepository.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ New issue: Primitive Obsession

In this module, 30.4% of all function arguments are primitive types, threshold = 30.0%. The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments.

Check warning on line 103 in tests/Umbraco.Tests.Integration/Umbraco.PublishedCache.HybridCache/DocumentHybridCacheMockTests.cs

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Code Health Review (main)

❌ Getting worse: Large Method

SetUp increases from 72 to 75 lines of code, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.