diff --git a/.github/test-ci-locally.ps1 b/.github/test-ci-locally.ps1 index fbdb1ae..fc04440 100644 --- a/.github/test-ci-locally.ps1 +++ b/.github/test-ci-locally.ps1 @@ -1,18 +1,18 @@ -# Local CI/CD Testing Script +# Local CI/CD Testing Script # This script replicates the GitHub Actions workflow locally for testing Write-Host "========================================" -ForegroundColor Cyan -Write-Host "SlidingWindowCache CI/CD Local Test" -ForegroundColor Cyan +Write-Host "Intervals.NET.Caching CI/CD Local Test" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" # Environment variables (matching GitHub Actions) -$env:SOLUTION_PATH = "SlidingWindowCache.sln" -$env:PROJECT_PATH = "src/SlidingWindowCache/SlidingWindowCache.csproj" -$env:WASM_VALIDATION_PATH = "src/SlidingWindowCache.WasmValidation/SlidingWindowCache.WasmValidation.csproj" -$env:UNIT_TEST_PATH = "tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj" -$env:INTEGRATION_TEST_PATH = "tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj" -$env:INVARIANTS_TEST_PATH = "tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj" +$env:SOLUTION_PATH = "Intervals.NET.Caching.sln" +$env:PROJECT_PATH = "src/Intervals.NET.Caching/Intervals.NET.Caching.csproj" +$env:WASM_VALIDATION_PATH = "src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj" +$env:UNIT_TEST_PATH = "tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj" +$env:INTEGRATION_TEST_PATH = "tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj" +$env:INVARIANTS_TEST_PATH = "tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj" # Track failures $failed = $false @@ -21,11 +21,11 @@ $failed = $false Write-Host "[Step 1/9] Restoring solution dependencies..." -ForegroundColor Yellow dotnet restore $env:SOLUTION_PATH if ($LASTEXITCODE -ne 0) { - Write-Host "❌ Restore failed" -ForegroundColor Red + Write-Host "? Restore failed" -ForegroundColor Red $failed = $true } else { - Write-Host "✅ Restore successful" -ForegroundColor Green + Write-Host "? Restore successful" -ForegroundColor Green } Write-Host "" @@ -33,11 +33,11 @@ Write-Host "" Write-Host "[Step 2/9] Building solution (Release)..." -ForegroundColor Yellow dotnet build $env:SOLUTION_PATH --configuration Release --no-restore if ($LASTEXITCODE -ne 0) { - Write-Host "❌ Build failed" -ForegroundColor Red + Write-Host "? Build failed" -ForegroundColor Red $failed = $true } else { - Write-Host "✅ Build successful" -ForegroundColor Green + Write-Host "? Build successful" -ForegroundColor Green } Write-Host "" @@ -45,11 +45,11 @@ Write-Host "" Write-Host "[Step 3/9] Validating WebAssembly compatibility..." -ForegroundColor Yellow dotnet build $env:WASM_VALIDATION_PATH --configuration Release --no-restore if ($LASTEXITCODE -ne 0) { - Write-Host "❌ WebAssembly validation failed" -ForegroundColor Red + Write-Host "? WebAssembly validation failed" -ForegroundColor Red $failed = $true } else { - Write-Host "✅ WebAssembly compilation successful - library is compatible with net8.0-browser" -ForegroundColor Green + Write-Host "? WebAssembly compilation successful - library is compatible with net8.0-browser" -ForegroundColor Green } Write-Host "" @@ -57,11 +57,11 @@ Write-Host "" Write-Host "[Step 4/9] Running Unit Tests with coverage..." -ForegroundColor Yellow dotnet test $env:UNIT_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Unit if ($LASTEXITCODE -ne 0) { - Write-Host "❌ Unit tests failed" -ForegroundColor Red + Write-Host "? Unit tests failed" -ForegroundColor Red $failed = $true } else { - Write-Host "✅ Unit tests passed" -ForegroundColor Green + Write-Host "? Unit tests passed" -ForegroundColor Green } Write-Host "" @@ -69,11 +69,11 @@ Write-Host "" Write-Host "[Step 5/9] Running Integration Tests with coverage..." -ForegroundColor Yellow dotnet test $env:INTEGRATION_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Integration if ($LASTEXITCODE -ne 0) { - Write-Host "❌ Integration tests failed" -ForegroundColor Red + Write-Host "? Integration tests failed" -ForegroundColor Red $failed = $true } else { - Write-Host "✅ Integration tests passed" -ForegroundColor Green + Write-Host "? Integration tests passed" -ForegroundColor Green } Write-Host "" @@ -81,11 +81,11 @@ Write-Host "" Write-Host "[Step 6/9] Running Invariants Tests with coverage..." -ForegroundColor Yellow dotnet test $env:INVARIANTS_TEST_PATH --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./TestResults/Invariants if ($LASTEXITCODE -ne 0) { - Write-Host "❌ Invariants tests failed" -ForegroundColor Red + Write-Host "? Invariants tests failed" -ForegroundColor Red $failed = $true } else { - Write-Host "✅ Invariants tests passed" -ForegroundColor Green + Write-Host "? Invariants tests passed" -ForegroundColor Green } Write-Host "" @@ -93,13 +93,13 @@ Write-Host "" Write-Host "[Step 7/9] Checking coverage files..." -ForegroundColor Yellow $coverageFiles = Get-ChildItem -Path "./TestResults" -Filter "coverage.cobertura.xml" -Recurse if ($coverageFiles.Count -gt 0) { - Write-Host "✅ Found $($coverageFiles.Count) coverage file(s)" -ForegroundColor Green + Write-Host "? Found $($coverageFiles.Count) coverage file(s)" -ForegroundColor Green foreach ($file in $coverageFiles) { Write-Host " - $($file.FullName)" -ForegroundColor Gray } } else { - Write-Host "⚠️ No coverage files found" -ForegroundColor Yellow + Write-Host "?? No coverage files found" -ForegroundColor Yellow } Write-Host "" @@ -110,12 +110,12 @@ if (Test-Path "./artifacts") { } dotnet pack $env:PROJECT_PATH --configuration Release --no-build --output ./artifacts if ($LASTEXITCODE -ne 0) { - Write-Host "❌ Package creation failed" -ForegroundColor Red + Write-Host "? Package creation failed" -ForegroundColor Red $failed = $true } else { $packages = Get-ChildItem -Path "./artifacts" -Filter "*.nupkg" - Write-Host "✅ Package created successfully" -ForegroundColor Green + Write-Host "? Package created successfully" -ForegroundColor Green foreach ($pkg in $packages) { Write-Host " - $($pkg.Name)" -ForegroundColor Gray } @@ -127,11 +127,11 @@ Write-Host "========================================" -ForegroundColor Cyan Write-Host "Test Summary" -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan if ($failed) { - Write-Host "❌ Some steps failed - see output above" -ForegroundColor Red + Write-Host "? Some steps failed - see output above" -ForegroundColor Red exit 1 } else { - Write-Host "✅ All steps passed successfully!" -ForegroundColor Green + Write-Host "? All steps passed successfully!" -ForegroundColor Green Write-Host "" Write-Host "Next steps:" -ForegroundColor Cyan Write-Host " - Review coverage reports in ./TestResults/" -ForegroundColor Gray diff --git a/.github/workflows/slidingwindowcache.yml b/.github/workflows/intervals-net-caching.yml similarity index 66% rename from .github/workflows/slidingwindowcache.yml rename to .github/workflows/intervals-net-caching.yml index b9a0542..516e24f 100644 --- a/.github/workflows/slidingwindowcache.yml +++ b/.github/workflows/intervals-net-caching.yml @@ -1,30 +1,30 @@ -name: CI/CD - SlidingWindowCache +name: CI/CD - Intervals.NET.Caching on: push: branches: [ master, main ] paths: - - 'src/SlidingWindowCache/**' - - 'src/SlidingWindowCache.WasmValidation/**' + - 'src/Intervals.NET.Caching/**' + - 'src/Intervals.NET.Caching.WasmValidation/**' - 'tests/**' - - '.github/workflows/slidingwindowcache.yml' + - '.github/workflows/Intervals.NET.Caching.yml' pull_request: branches: [ master, main ] paths: - - 'src/SlidingWindowCache/**' - - 'src/SlidingWindowCache.WasmValidation/**' + - 'src/Intervals.NET.Caching/**' + - 'src/Intervals.NET.Caching.WasmValidation/**' - 'tests/**' - - '.github/workflows/slidingwindowcache.yml' + - '.github/workflows/Intervals.NET.Caching.yml' workflow_dispatch: env: DOTNET_VERSION: '8.x.x' - SOLUTION_PATH: 'SlidingWindowCache.sln' - PROJECT_PATH: 'src/SlidingWindowCache/SlidingWindowCache.csproj' - WASM_VALIDATION_PATH: 'src/SlidingWindowCache.WasmValidation/SlidingWindowCache.WasmValidation.csproj' - UNIT_TEST_PATH: 'tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj' - INTEGRATION_TEST_PATH: 'tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj' - INVARIANTS_TEST_PATH: 'tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj' + SOLUTION_PATH: 'Intervals.NET.Caching.sln' + PROJECT_PATH: 'src/Intervals.NET.Caching/Intervals.NET.Caching.csproj' + WASM_VALIDATION_PATH: 'src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj' + UNIT_TEST_PATH: 'tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj' + INTEGRATION_TEST_PATH: 'tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj' + INVARIANTS_TEST_PATH: 'tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj' jobs: build-and-test: @@ -48,9 +48,9 @@ jobs: - name: Validate WebAssembly compatibility run: | echo "::group::WebAssembly Validation" - echo "Building SlidingWindowCache.WasmValidation for net8.0-browser target..." + echo "Building Intervals.NET.Caching.WasmValidation for net8.0-browser target..." dotnet build ${{ env.WASM_VALIDATION_PATH }} --configuration Release --no-restore - echo "✅ WebAssembly compilation successful - library is compatible with net8.0-browser" + echo "? WebAssembly compilation successful - library is compatible with net8.0-browser" echo "::endgroup::" - name: Run Unit Tests with coverage @@ -89,17 +89,17 @@ jobs: - name: Restore dependencies run: dotnet restore ${{ env.PROJECT_PATH }} - - name: Build SlidingWindowCache + - name: Build Intervals.NET.Caching run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore - - name: Pack SlidingWindowCache + - name: Pack Intervals.NET.Caching run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output ./artifacts - - name: Publish SlidingWindowCache to NuGet - run: dotnet nuget push ./artifacts/SlidingWindowCache.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + - name: Publish Intervals.NET.Caching to NuGet + run: dotnet nuget push ./artifacts/Intervals.NET.Caching.*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate - name: Upload package artifacts uses: actions/upload-artifact@v4 with: - name: slidingwindowcache-package + name: Intervals.NET.Caching-package path: ./artifacts/*.nupkg diff --git a/AGENTS.md b/AGENTS.md index b8b3ec4..8b37e9c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,10 +1,10 @@ -# Agent Guidelines for SlidingWindowCache +# Agent Guidelines for Intervals.NET.Caching -This document provides essential information for AI coding agents working on the SlidingWindowCache codebase. +This document provides essential information for AI coding agents working on the Intervals.NET.Caching codebase. ## Project Overview -**SlidingWindowCache** is a C# .NET 8.0 library implementing a read-only, range-based, sequential-optimized cache with decision-driven background rebalancing. This is a production-ready concurrent systems project with extensive architectural documentation. +**Intervals.NET.Caching** is a C# .NET 8.0 library implementing a read-only, range-based, sequential-optimized cache with decision-driven background rebalancing. This is a production-ready concurrent systems project with extensive architectural documentation. **Key Architecture Principles:** - Single-Writer Architecture: Only rebalance execution mutates cache state @@ -21,19 +21,19 @@ This document provides essential information for AI coding agents working on the ### Common Build Commands ```bash # Restore dependencies -dotnet restore SlidingWindowCache.sln +dotnet restore Intervals.NET.Caching.sln # Build solution (Debug) -dotnet build SlidingWindowCache.sln +dotnet build Intervals.NET.Caching.sln # Build solution (Release) -dotnet build SlidingWindowCache.sln --configuration Release +dotnet build Intervals.NET.Caching.sln --configuration Release # Build specific project -dotnet build src/SlidingWindowCache/SlidingWindowCache.csproj --configuration Release +dotnet build src/Intervals.NET.Caching/Intervals.NET.Caching.csproj --configuration Release # Pack for NuGet -dotnet pack src/SlidingWindowCache/SlidingWindowCache.csproj --configuration Release --output ./artifacts +dotnet pack src/Intervals.NET.Caching/Intervals.NET.Caching.csproj --configuration Release --output ./artifacts ``` ## Test Commands @@ -42,15 +42,15 @@ dotnet pack src/SlidingWindowCache/SlidingWindowCache.csproj --configuration Rel ```bash # Run all tests -dotnet test SlidingWindowCache.sln --configuration Release +dotnet test Intervals.NET.Caching.sln --configuration Release # Run specific test project -dotnet test tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj -dotnet test tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj -dotnet test tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj +dotnet test tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj +dotnet test tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj +dotnet test tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj # Run single test by fully qualified name -dotnet test --filter "FullyQualifiedName=SlidingWindowCache.Unit.Tests.Public.Configuration.WindowCacheOptionsTests.Constructor_WithValidParameters_InitializesAllProperties" +dotnet test --filter "FullyQualifiedName=Intervals.NET.Caching.Unit.Tests.Public.Configuration.WindowCacheOptionsTests.Constructor_WithValidParameters_InitializesAllProperties" # Run tests matching pattern dotnet test --filter "FullyQualifiedName~Constructor" @@ -77,15 +77,15 @@ dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults ### Namespace Organization ```csharp // Use file-scoped namespace declarations (C# 10+) -namespace SlidingWindowCache.Public; -namespace SlidingWindowCache.Core.UserPath; -namespace SlidingWindowCache.Infrastructure.Storage; +namespace Intervals.NET.Caching.Public; +namespace Intervals.NET.Caching.Core.UserPath; +namespace Intervals.NET.Caching.Infrastructure.Storage; ``` **Namespace Structure:** -- `SlidingWindowCache.Public` - Public API surface -- `SlidingWindowCache.Core` - Business logic (internal) -- `SlidingWindowCache.Infrastructure` - Infrastructure concerns (internal) +- `Intervals.NET.Caching.Public` - Public API surface +- `Intervals.NET.Caching.Core` - Business logic (internal) +- `Intervals.NET.Caching.Infrastructure` - Infrastructure concerns (internal) ### Naming Conventions @@ -123,16 +123,16 @@ namespace SlidingWindowCache.Infrastructure.Storage; **Import Order:** 1. External libraries (e.g., `Intervals.NET`) -2. Project namespaces (e.g., `SlidingWindowCache.*`) +2. Project namespaces (e.g., `Intervals.NET.Caching.*`) 3. Alphabetically sorted within each group **Example:** ```csharp using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Planning; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Core.Planning; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Public.Instrumentation; ``` ### XML Documentation @@ -350,24 +350,24 @@ refactor: AsyncActivityCounter lock has been removed and replaced with lock-free ## File Locations **Public API:** -- `src/SlidingWindowCache/Public/WindowCache.cs` - Main cache facade -- `src/SlidingWindowCache/Public/IDataSource.cs` - Data source contract -- `src/SlidingWindowCache/Public/Configuration/` - Configuration classes -- `src/SlidingWindowCache/Public/Instrumentation/` - Diagnostics +- `src/Intervals.NET.Caching/Public/WindowCache.cs` - Main cache facade +- `src/Intervals.NET.Caching/Public/IDataSource.cs` - Data source contract +- `src/Intervals.NET.Caching/Public/Configuration/` - Configuration classes +- `src/Intervals.NET.Caching/Public/Instrumentation/` - Diagnostics **Core Logic:** -- `src/SlidingWindowCache/Core/UserPath/` - User request handling (read-only) -- `src/SlidingWindowCache/Core/Rebalance/Decision/` - Decision engine -- `src/SlidingWindowCache/Core/Rebalance/Execution/` - Cache mutations (single writer) -- `src/SlidingWindowCache/Core/State/` - State management +- `src/Intervals.NET.Caching/Core/UserPath/` - User request handling (read-only) +- `src/Intervals.NET.Caching/Core/Rebalance/Decision/` - Decision engine +- `src/Intervals.NET.Caching/Core/Rebalance/Execution/` - Cache mutations (single writer) +- `src/Intervals.NET.Caching/Core/State/` - State management **Infrastructure:** -- `src/SlidingWindowCache/Infrastructure/Storage/` - Storage strategies -- `src/SlidingWindowCache/Infrastructure/Concurrency/` - Async coordination +- `src/Intervals.NET.Caching/Infrastructure/Storage/` - Storage strategies +- `src/Intervals.NET.Caching/Infrastructure/Concurrency/` - Async coordination ## CI/CD -**GitHub Actions:** `.github/workflows/slidingwindowcache.yml` +**GitHub Actions:** `.github/workflows/Intervals.NET.Caching.yml` - Triggers: Push/PR to main/master, manual dispatch - Runs: Build, WebAssembly validation, all test suites with coverage - Coverage: Uploaded to Codecov diff --git a/SlidingWindowCache.sln b/Intervals.NET.Caching.sln similarity index 77% rename from SlidingWindowCache.sln rename to Intervals.NET.Caching.sln index 89a5d6b..34d0fbd 100644 --- a/SlidingWindowCache.sln +++ b/Intervals.NET.Caching.sln @@ -1,7 +1,7 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlidingWindowCache", "src\SlidingWindowCache\SlidingWindowCache.csproj", "{40C9BEF3-8CFA-43CC-AFE0-7E374DF7F9A5}" +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Caching", "src\Intervals.NET.Caching\Intervals.NET.Caching.csproj", "{40C9BEF3-8CFA-43CC-AFE0-7E374DF7F9A5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlidingWindowCache.WasmValidation", "src\SlidingWindowCache.WasmValidation\SlidingWindowCache.WasmValidation.csproj", "{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Caching.WasmValidation", "src\Intervals.NET.Caching.WasmValidation\Intervals.NET.Caching.WasmValidation.csproj", "{A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{EB667A96-0E73-48B6-ACC8-C99369A59D0D}" ProjectSection(SolutionItems) = preProject @@ -25,22 +25,22 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2126ACFB-75E EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{8C504091-1383-4EEB-879E-7A3769C3DF13}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlidingWindowCache.Invariants.Tests", "tests\SlidingWindowCache.Invariants.Tests\SlidingWindowCache.Invariants.Tests.csproj", "{17AB54EA-D245-4867-A047-ED55B4D94C17}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Caching.Invariants.Tests", "tests\Intervals.NET.Caching.Invariants.Tests\Intervals.NET.Caching.Invariants.Tests.csproj", "{17AB54EA-D245-4867-A047-ED55B4D94C17}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlidingWindowCache.Integration.Tests", "tests\SlidingWindowCache.Integration.Tests\SlidingWindowCache.Integration.Tests.csproj", "{0023794C-FAD3-490C-96E3-448C68ED2569}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Caching.Integration.Tests", "tests\Intervals.NET.Caching.Integration.Tests\Intervals.NET.Caching.Integration.Tests.csproj", "{0023794C-FAD3-490C-96E3-448C68ED2569}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlidingWindowCache.Unit.Tests", "tests\SlidingWindowCache.Unit.Tests\SlidingWindowCache.Unit.Tests.csproj", "{906F9E4F-0EFA-4FE8-8DA2-DDECE22B7306}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Caching.Unit.Tests", "tests\Intervals.NET.Caching.Unit.Tests\Intervals.NET.Caching.Unit.Tests.csproj", "{906F9E4F-0EFA-4FE8-8DA2-DDECE22B7306}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlidingWindowCache.Tests.Infrastructure", "tests\SlidingWindowCache.Tests.Infrastructure\SlidingWindowCache.Tests.Infrastructure.csproj", "{C1D2E3F4-A5B6-4C7D-8E9F-0A1B2C3D4E5F}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Caching.Tests.Infrastructure", "tests\Intervals.NET.Caching.Tests.Infrastructure\Intervals.NET.Caching.Tests.Infrastructure.csproj", "{C1D2E3F4-A5B6-4C7D-8E9F-0A1B2C3D4E5F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cicd", "cicd", "{9C6688E8-071B-48F5-9B84-4779B58822CC}" ProjectSection(SolutionItems) = preProject - .github\workflows\slidingwindowcache.yml = .github\workflows\slidingwindowcache.yml + .github\workflows\Intervals.NET.Caching.yml = .github\workflows\Intervals.NET.Caching.yml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{EB0F4813-1FA9-4C40-A975-3B8C6BBFF8D5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlidingWindowCache.Benchmarks", "benchmarks\SlidingWindowCache.Benchmarks\SlidingWindowCache.Benchmarks.csproj", "{8E83B41E-08E9-4AF4-8272-1AB2D2DEDBAB}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intervals.NET.Caching.Benchmarks", "benchmarks\Intervals.NET.Caching.Benchmarks\Intervals.NET.Caching.Benchmarks.csproj", "{8E83B41E-08E9-4AF4-8272-1AB2D2DEDBAB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "components", "components", "{CE3B07FD-0EC6-4C58-BA45-C23111D5A934}" ProjectSection(SolutionItems) = preProject diff --git a/README.md b/README.md index feed8ea..d2b991e 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ -# Sliding Window Cache +# Intervals.NET.Caching +## Sliding Window Cache A read-only, range-based, sequential-optimized cache with decision-driven background rebalancing, three consistency modes (eventual/hybrid/strong), and intelligent work avoidance. -[![CI/CD](https://github.com/blaze6950/SlidingWindowCache/actions/workflows/slidingwindowcache.yml/badge.svg)](https://github.com/blaze6950/SlidingWindowCache/actions/workflows/slidingwindowcache.yml) -[![NuGet](https://img.shields.io/nuget/v/SlidingWindowCache.svg)](https://www.nuget.org/packages/SlidingWindowCache/) -[![NuGet Downloads](https://img.shields.io/nuget/dt/SlidingWindowCache.svg)](https://www.nuget.org/packages/SlidingWindowCache/) -[![codecov](https://codecov.io/gh/blaze6950/SlidingWindowCache/graph/badge.svg?token=RFQBNX7MMD)](https://codecov.io/gh/blaze6950/SlidingWindowCache) +[![CI/CD](https://github.com/blaze6950/Intervals.NET.Caching/actions/workflows/intervals-net-caching.yml/badge.svg)](https://github.com/blaze6950/Intervals.NET.Caching/actions/workflows/intervals-net-caching.yml) +[![NuGet](https://img.shields.io/nuget/v/Intervals.NET.Caching.svg)](https://www.nuget.org/packages/Intervals.NET.Caching/) +[![NuGet Downloads](https://img.shields.io/nuget/dt/Intervals.NET.Caching.svg)](https://www.nuget.org/packages/Intervals.NET.Caching/) +[![codecov](https://codecov.io/gh/blaze6950/Intervals.NET.Caching/graph/badge.svg?token=RFQBNX7MMD)](https://codecov.io/gh/blaze6950/Intervals.NET.Caching) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![.NET 8.0](https://img.shields.io/badge/.NET-8.0-blue.svg)](https://dotnet.microsoft.com/download/dotnet/8.0) @@ -24,7 +25,7 @@ For the canonical architecture docs, see `docs/architecture.md`. ## Install ```bash -dotnet add package SlidingWindowCache +dotnet add package Intervals.NET.Caching ``` ## Sliding Window Cache Concept @@ -143,9 +144,9 @@ For detailed comparison and guidance, see `docs/storage-strategies.md`. ## Quick Start ```csharp -using SlidingWindowCache; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; @@ -171,8 +172,8 @@ Implement `IDataSource` to connect the cache to your backing stor `FuncDataSource` wraps an async delegate so you can create a data source in one expression: ```csharp -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; // Unbounded source — always returns data for any range IDataSource source = new FuncDataSource( @@ -400,7 +401,7 @@ Canonical guide: `docs/diagnostics.md`. ## Consistency Modes -By default, `GetDataAsync` is **eventually consistent**: data is returned immediately while the cache window converges asynchronously in the background. Two opt-in extension methods provide stronger consistency guarantees. Both require a `using SlidingWindowCache.Public;` import. +By default, `GetDataAsync` is **eventually consistent**: data is returned immediately while the cache window converges asynchronously in the background. Two opt-in extension methods provide stronger consistency guarantees. Both require a `using Intervals.NET.Caching.Public;` import. > **Serialized access requirement:** The hybrid and strong consistency modes provide their warm-cache guarantee only when requests are made one at a time (serialized). Under concurrent/parallel callers they remain safe (no crashes or hangs) but the guarantee degrades — due to `AsyncActivityCounter`'s "was idle at some point" semantics (Invariant H.3) and a brief gap between the counter increment and TCS publication in `IncrementActivity`, a concurrent waiter may observe a previously completed idle TCS and return without waiting for the new rebalance. @@ -416,7 +417,7 @@ Use for all hot paths and rapid sequential access. No latency beyond data assemb ### Hybrid Consistency — `GetDataAndWaitOnMissAsync` ```csharp -using SlidingWindowCache.Public; +using Intervals.NET.Caching.Public; // Waits for idle only if the request was a PartialHit or FullMiss; returns immediately on FullHit var result = await cache.GetDataAndWaitOnMissAsync( @@ -444,7 +445,7 @@ if (result.Range.HasValue) ### Strong Consistency — `GetDataAndWaitForIdleAsync` ```csharp -using SlidingWindowCache.Public; +using Intervals.NET.Caching.Public; // Returns only after cache has converged to its desired window geometry var result = await cache.GetDataAndWaitForIdleAsync( diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/ExecutionStrategyBenchmarks.cs b/benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/ExecutionStrategyBenchmarks.cs similarity index 98% rename from benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/ExecutionStrategyBenchmarks.cs rename to benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/ExecutionStrategyBenchmarks.cs index ab20a0b..aefa9d5 100644 --- a/benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/ExecutionStrategyBenchmarks.cs +++ b/benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/ExecutionStrategyBenchmarks.cs @@ -2,12 +2,12 @@ using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; using Intervals.NET.Domain.Extensions.Fixed; -using SlidingWindowCache.Benchmarks.Infrastructure; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching.Benchmarks.Infrastructure; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; -namespace SlidingWindowCache.Benchmarks.Benchmarks; +namespace Intervals.NET.Caching.Benchmarks.Benchmarks; /// /// Execution Strategy Benchmarks diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/RebalanceFlowBenchmarks.cs b/benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/RebalanceFlowBenchmarks.cs similarity index 97% rename from benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/RebalanceFlowBenchmarks.cs rename to benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/RebalanceFlowBenchmarks.cs index 731299d..05cbdfb 100644 --- a/benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/RebalanceFlowBenchmarks.cs +++ b/benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/RebalanceFlowBenchmarks.cs @@ -2,12 +2,12 @@ using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; using Intervals.NET.Domain.Extensions.Fixed; -using SlidingWindowCache.Benchmarks.Infrastructure; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching.Benchmarks.Infrastructure; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; -namespace SlidingWindowCache.Benchmarks.Benchmarks; +namespace Intervals.NET.Caching.Benchmarks.Benchmarks; /// /// Rebalance Flow Benchmarks diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/ScenarioBenchmarks.cs b/benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/ScenarioBenchmarks.cs similarity index 94% rename from benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/ScenarioBenchmarks.cs rename to benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/ScenarioBenchmarks.cs index 717072f..ce857ef 100644 --- a/benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/ScenarioBenchmarks.cs +++ b/benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/ScenarioBenchmarks.cs @@ -1,12 +1,12 @@ using BenchmarkDotNet.Attributes; using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Benchmarks.Infrastructure; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching.Benchmarks.Infrastructure; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; -namespace SlidingWindowCache.Benchmarks.Benchmarks; +namespace Intervals.NET.Caching.Benchmarks.Benchmarks; /// /// Scenario Benchmarks diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/UserFlowBenchmarks.cs b/benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/UserFlowBenchmarks.cs similarity index 97% rename from benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/UserFlowBenchmarks.cs rename to benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/UserFlowBenchmarks.cs index 05b7bb5..8d35eee 100644 --- a/benchmarks/SlidingWindowCache.Benchmarks/Benchmarks/UserFlowBenchmarks.cs +++ b/benchmarks/Intervals.NET.Caching.Benchmarks/Benchmarks/UserFlowBenchmarks.cs @@ -2,12 +2,12 @@ using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; using Intervals.NET.Domain.Extensions.Fixed; -using SlidingWindowCache.Benchmarks.Infrastructure; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching.Benchmarks.Infrastructure; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; -namespace SlidingWindowCache.Benchmarks.Benchmarks; +namespace Intervals.NET.Caching.Benchmarks.Benchmarks; /// /// User Request Flow Benchmarks diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SlowDataSource.cs b/benchmarks/Intervals.NET.Caching.Benchmarks/Infrastructure/SlowDataSource.cs similarity index 96% rename from benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SlowDataSource.cs rename to benchmarks/Intervals.NET.Caching.Benchmarks/Infrastructure/SlowDataSource.cs index c99ed4d..cafd5ba 100644 --- a/benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SlowDataSource.cs +++ b/benchmarks/Intervals.NET.Caching.Benchmarks/Infrastructure/SlowDataSource.cs @@ -1,9 +1,9 @@ using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Benchmarks.Infrastructure; +namespace Intervals.NET.Caching.Benchmarks.Infrastructure; /// /// Configurable-latency IDataSource for testing execution strategy behavior with realistic I/O delays. diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SynchronousDataSource.cs b/benchmarks/Intervals.NET.Caching.Benchmarks/Infrastructure/SynchronousDataSource.cs similarity index 92% rename from benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SynchronousDataSource.cs rename to benchmarks/Intervals.NET.Caching.Benchmarks/Infrastructure/SynchronousDataSource.cs index 2585c07..ce2e8d2 100644 --- a/benchmarks/SlidingWindowCache.Benchmarks/Infrastructure/SynchronousDataSource.cs +++ b/benchmarks/Intervals.NET.Caching.Benchmarks/Infrastructure/SynchronousDataSource.cs @@ -1,10 +1,10 @@ -using Intervals.NET; +using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; using Intervals.NET.Domain.Extensions.Fixed; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Benchmarks.Infrastructure; +namespace Intervals.NET.Caching.Benchmarks.Infrastructure; /// /// Zero-latency synchronous IDataSource for isolating rebalance and cache mutation costs. diff --git a/benchmarks/SlidingWindowCache.Benchmarks/SlidingWindowCache.Benchmarks.csproj b/benchmarks/Intervals.NET.Caching.Benchmarks/Intervals.NET.Caching.Benchmarks.csproj similarity index 88% rename from benchmarks/SlidingWindowCache.Benchmarks/SlidingWindowCache.Benchmarks.csproj rename to benchmarks/Intervals.NET.Caching.Benchmarks/Intervals.NET.Caching.Benchmarks.csproj index 77bb229..e80b8aa 100644 --- a/benchmarks/SlidingWindowCache.Benchmarks/SlidingWindowCache.Benchmarks.csproj +++ b/benchmarks/Intervals.NET.Caching.Benchmarks/Intervals.NET.Caching.Benchmarks.csproj @@ -13,14 +13,14 @@ - + - + diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Program.cs b/benchmarks/Intervals.NET.Caching.Benchmarks/Program.cs similarity index 70% rename from benchmarks/SlidingWindowCache.Benchmarks/Program.cs rename to benchmarks/Intervals.NET.Caching.Benchmarks/Program.cs index 5e4ca39..146b211 100644 --- a/benchmarks/SlidingWindowCache.Benchmarks/Program.cs +++ b/benchmarks/Intervals.NET.Caching.Benchmarks/Program.cs @@ -1,9 +1,9 @@ -using BenchmarkDotNet.Running; +using BenchmarkDotNet.Running; -namespace SlidingWindowCache.Benchmarks; +namespace Intervals.NET.Caching.Benchmarks; /// -/// BenchmarkDotNet runner for SlidingWindowCache performance benchmarks. +/// BenchmarkDotNet runner for Intervals.NET.Caching performance benchmarks. /// public class Program { diff --git a/benchmarks/SlidingWindowCache.Benchmarks/README.md b/benchmarks/Intervals.NET.Caching.Benchmarks/README.md similarity index 74% rename from benchmarks/SlidingWindowCache.Benchmarks/README.md rename to benchmarks/Intervals.NET.Caching.Benchmarks/README.md index bdb8d04..ffe63a4 100644 --- a/benchmarks/SlidingWindowCache.Benchmarks/README.md +++ b/benchmarks/Intervals.NET.Caching.Benchmarks/README.md @@ -1,6 +1,6 @@ -# SlidingWindowCache Benchmarks +# Intervals.NET.Caching Benchmarks -Comprehensive BenchmarkDotNet performance suite for SlidingWindowCache, measuring architectural performance characteristics using **public API only**. +Comprehensive BenchmarkDotNet performance suite for Intervals.NET.Caching, measuring architectural performance characteristics using **public API only**. **Methodologically Correct Benchmarks**: This suite follows rigorous benchmark methodology to ensure deterministic, reliable, and interpretable results. @@ -8,12 +8,12 @@ Comprehensive BenchmarkDotNet performance suite for SlidingWindowCache, measurin ## Current Performance Baselines -For current measured performance data, see the committed reports in `benchmarks/SlidingWindowCache.Benchmarks/Results/`: +For current measured performance data, see the committed reports in `benchmarks/Intervals.NET.Caching.Benchmarks/Results/`: -- **User Request Flow**: [UserFlowBenchmarks-report-github.md](Results/SlidingWindowCache.Benchmarks.Benchmarks.UserFlowBenchmarks-report-github.md) -- **Rebalance Mechanics**: [RebalanceFlowBenchmarks-report-github.md](Results/SlidingWindowCache.Benchmarks.Benchmarks.RebalanceFlowBenchmarks-report-github.md) -- **End-to-End Scenarios**: [ScenarioBenchmarks-report-github.md](Results/SlidingWindowCache.Benchmarks.Benchmarks.ScenarioBenchmarks-report-github.md) -- **Execution Strategy Comparison**: [ExecutionStrategyBenchmarks-report-github.md](Results/SlidingWindowCache.Benchmarks.Benchmarks.ExecutionStrategyBenchmarks-report-github.md) +- **User Request Flow**: [UserFlowBenchmarks-report-github.md](Results/Intervals.NET.Caching.Benchmarks.Benchmarks.UserFlowBenchmarks-report-github.md) +- **Rebalance Mechanics**: [RebalanceFlowBenchmarks-report-github.md](Results/Intervals.NET.Caching.Benchmarks.Benchmarks.RebalanceFlowBenchmarks-report-github.md) +- **End-to-End Scenarios**: [ScenarioBenchmarks-report-github.md](Results/Intervals.NET.Caching.Benchmarks.Benchmarks.ScenarioBenchmarks-report-github.md) +- **Execution Strategy Comparison**: [ExecutionStrategyBenchmarks-report-github.md](Results/Intervals.NET.Caching.Benchmarks.Benchmarks.ExecutionStrategyBenchmarks-report-github.md) These reports are updated when benchmarks are re-run and committed to track performance over time. @@ -21,17 +21,17 @@ These reports are updated when benchmarks are re-run and committed to track perf ## Overview -This benchmark project provides reliable, deterministic performance measurements organized around **two distinct execution flows** of SlidingWindowCache: +This benchmark project provides reliable, deterministic performance measurements organized around **two distinct execution flows** of Intervals.NET.Caching: ### Execution Flow Model -SlidingWindowCache has **two independent cost centers**: +Intervals.NET.Caching has **two independent cost centers**: -1. **User Request Flow** → Measures latency/cost of user-facing API calls +1. **User Request Flow** > Measures latency/cost of user-facing API calls - Rebalance/background activity is **NOT** included in measured results - Focus: Direct `GetDataAsync` call overhead -2. **Rebalance/Maintenance Flow** → Measures cost of window maintenance operations +2. **Rebalance/Maintenance Flow** > Measures cost of window maintenance operations - Explicitly waits for stabilization using `WaitForIdleAsync` - Focus: Background window management and cache mutation costs @@ -61,9 +61,9 @@ These benchmarks use a 2-axis parameter matrix to explore cache sizing tradeoffs 2. **`CacheCoefficientSize`** - Left/right prefetch multipliers - Values: `[1, 10, 100]` - Purpose: Test rebalance cost vs cache size tradeoff - - Total cache size = `RangeSpan × (1 + leftCoeff + rightCoeff)` + - Total cache size = `RangeSpan ? (1 + leftCoeff + rightCoeff)` -**Parameter Matrix**: 3 range sizes × 3 cache coefficients = **9 parameter combinations per benchmark method** +**Parameter Matrix**: 3 range sizes ? 3 cache coefficients = **9 parameter combinations per benchmark method** ### Rebalance Flow Benchmarks Parameters @@ -84,23 +84,23 @@ These benchmarks use a 3-axis orthogonal design to isolate rebalance behavior: - Values: `[100, 1_000, 10_000]` - Purpose: Test scaling behavior from small to large data volumes -**Parameter Matrix**: 3 behaviors × 2 strategies × 3 sizes = **18 parameter combinations** +**Parameter Matrix**: 3 behaviors ? 2 strategies ? 3 sizes = **18 parameter combinations** ### Expected Scaling Insights **Snapshot Mode:** -- ✅ **Advantage at small-to-medium sizes** (RangeSpan < 10,000) +- ? **Advantage at small-to-medium sizes** (RangeSpan < 10,000) - Zero-allocation reads dominate - Rebalance cost acceptable -- ⚠️ **LOH pressure at large sizes** (RangeSpan ≥ 10,000) +- ?? **LOH pressure at large sizes** (RangeSpan ? 10,000) - Array allocations go to LOH (no compaction) - GC pressure increases with Gen2 collections visible **CopyOnRead Mode:** -- ❌ **Disadvantage at small sizes** (RangeSpan < 1,000) +- ? **Disadvantage at small sizes** (RangeSpan < 1,000) - Per-read allocation overhead visible - List overhead not amortized -- ✅ **Competitive at medium-to-large sizes** (RangeSpan ≥ 1,000) +- ? **Competitive at medium-to-large sizes** (RangeSpan ? 1,000) - List growth amortizes allocation cost - Reduced LOH pressure @@ -131,24 +131,24 @@ When analyzing results, look for: ## Design Principles ### 1. Public API Only -- ✅ No internal types -- ✅ No reflection -- ✅ Only uses public `WindowCache` API +- ? No internal types +- ? No reflection +- ? Only uses public `WindowCache` API ### 2. Deterministic Behavior -- ✅ `SynchronousDataSource` with no randomness -- ✅ `SynchronousDataSource` for zero-latency isolation -- ✅ Stable, predictable data generation -- ✅ No I/O operations +- ? `SynchronousDataSource` with no randomness +- ? `SynchronousDataSource` for zero-latency isolation +- ? Stable, predictable data generation +- ? No I/O operations ### 3. Methodological Rigor -- ✅ **No state reuse**: Fresh cache per iteration via `[IterationSetup]` -- ✅ **Explicit rebalance handling**: `WaitForIdleAsync` in setup/cleanup for `UserFlowBenchmarks`; INSIDE benchmark method for `RebalanceFlowBenchmarks` (measuring rebalance completion as part of cost) -- ✅ **Clear separation**: Read microbenchmarks vs partial-hit vs scenario-level -- ✅ **Isolation**: Each benchmark measures ONE thing -- ✅ **MemoryDiagnoser** for allocation tracking -- ✅ **MarkdownExporter** for report generation -- ✅ **Parameterization**: Comprehensive scaling analysis +- ? **No state reuse**: Fresh cache per iteration via `[IterationSetup]` +- ? **Explicit rebalance handling**: `WaitForIdleAsync` in setup/cleanup for `UserFlowBenchmarks`; INSIDE benchmark method for `RebalanceFlowBenchmarks` (measuring rebalance completion as part of cost) +- ? **Clear separation**: Read microbenchmarks vs partial-hit vs scenario-level +- ? **Isolation**: Each benchmark measures ONE thing +- ? **MemoryDiagnoser** for allocation tracking +- ? **MarkdownExporter** for report generation +- ? **Parameterization**: Comprehensive scaling analysis --- @@ -162,7 +162,7 @@ Benchmarks are organized by **execution flow** to clearly separate user-facing c **Goal**: Measure ONLY user-facing request latency. Rebalance/background activity is EXCLUDED from measurements. -**Parameters**: `RangeSpan` × `CacheCoefficientSize` = **9 combinations** +**Parameters**: `RangeSpan` ? `CacheCoefficientSize` = **9 combinations** - RangeSpan: `[100, 1_000, 10_000]` - CacheCoefficientSize: `[1, 10, 100]` @@ -204,7 +204,7 @@ Benchmarks are organized by **execution flow** to clearly separate user-facing c - **Storage Strategy** (Snapshot/CopyOnRead) - Rematerialization approach - **Base Span Size** (100/1,000/10,000) - Scaling behavior -**Parameters**: `Behavior` × `Strategy` × `BaseSpanSize` = **18 combinations** +**Parameters**: `Behavior` ? `Strategy` ? `BaseSpanSize` = **18 combinations** - Behavior: `[Fixed, Growing, Shrinking]` - Strategy: `[Snapshot, CopyOnRead]` - BaseSpanSize: `[100, 1_000, 10_000]` @@ -244,7 +244,7 @@ Benchmarks are organized by **execution flow** to clearly separate user-facing c **Goal**: End-to-end scenario testing focusing on cold start performance. NOT microbenchmarks - measures complete workflows. -**Parameters**: `RangeSpan` × `CacheCoefficientSize` = **9 combinations** +**Parameters**: `RangeSpan` ? `CacheCoefficientSize` = **9 combinations** - RangeSpan: `[100, 1_000, 10_000]` - CacheCoefficientSize: `[1, 10, 100]` @@ -281,10 +281,10 @@ Benchmarks are organized by **execution flow** to clearly separate user-facing c **Goal**: Compare unbounded vs bounded execution queue performance under rapid burst request patterns with cache-hit optimization. Measures how queue capacity configuration affects system convergence time under varying I/O latencies and burst loads. **Philosophy**: This benchmark evaluates the performance trade-offs between: -- **Unbounded (NoCapacity)**: `RebalanceQueueCapacity = null` → Task-based execution with unbounded accumulation -- **Bounded (WithCapacity)**: `RebalanceQueueCapacity = 10` → Channel-based execution with bounded queue and backpressure +- **Unbounded (NoCapacity)**: `RebalanceQueueCapacity = null` > Task-based execution with unbounded accumulation +- **Bounded (WithCapacity)**: `RebalanceQueueCapacity = 10` > Channel-based execution with bounded queue and backpressure -**Parameters**: `DataSourceLatencyMs` × `BurstSize` = **9 combinations** +**Parameters**: `DataSourceLatencyMs` ? `BurstSize` = **9 combinations** - DataSourceLatencyMs: `[0, 50, 100]` - Simulates network/database I/O latency - BurstSize: `[10, 100, 1000]` - Number of rapid sequential requests @@ -301,17 +301,17 @@ Benchmarks are organized by **execution flow** to clearly separate user-facing c | Method | Baseline | Configuration | Implementation | Purpose | |-----------------------------|----------|---------------------------------|---------------------------------|---------------------------------| -| `BurstPattern_NoCapacity` | ✓ Yes | `RebalanceQueueCapacity = null` | Task-based unbounded execution | Baseline for ratio calculations | +| `BurstPattern_NoCapacity` | ? Yes | `RebalanceQueueCapacity = null` | Task-based unbounded execution | Baseline for ratio calculations | | `BurstPattern_WithCapacity` | - | `RebalanceQueueCapacity = 10` | Channel-based bounded execution | Measured relative to baseline | **Interpretation Guide**: **Ratio Column Interpretation**: - **Ratio < 1.0**: WithCapacity is faster than NoCapacity - - Example: Ratio = 0.012 means WithCapacity is 83× faster (1 / 0.012 ≈ 83) + - Example: Ratio = 0.012 means WithCapacity is 83? faster (1 / 0.012 ? 83) - **Ratio > 1.0**: WithCapacity is slower than NoCapacity - - Example: Ratio = 1.44 means WithCapacity is 1.44× slower (44% overhead) -- **Ratio ≈ 1.0**: Both strategies perform similarly + - Example: Ratio = 1.44 means WithCapacity is 1.44? slower (44% overhead) +- **Ratio ? 1.0**: Both strategies perform similarly **What to Look For**: @@ -323,13 +323,13 @@ Benchmarks are organized by **execution flow** to clearly separate user-facing c **When to Use Each Strategy**: -✅ **Unbounded (NoCapacity) - Recommended for typical use cases**: +? **Unbounded (NoCapacity) - Recommended for typical use cases**: - Web APIs with moderate scrolling (10-100 rapid requests) - Gaming/real-time with fast local data - Scenarios where burst sizes remain moderate - Minimal overhead, excellent typical-case performance -✅ **Bounded (WithCapacity) - High-frequency edge cases**: +? **Bounded (WithCapacity) - High-frequency edge cases**: - Streaming sensor data at very high frequencies (1000+ Hz) with network I/O - Scenarios with extreme burst sizes and significant I/O latency - When predictable bounded behavior is critical @@ -342,29 +342,29 @@ Benchmarks are organized by **execution flow** to clearly separate user-facing c ```bash # Run all benchmarks (WARNING: This will take 2-4 hours with current parameterization) -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks # Run specific benchmark class -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*UserFlowBenchmarks*" -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*RebalanceFlowBenchmarks*" -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*ScenarioBenchmarks*" -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*ExecutionStrategyBenchmarks*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*UserFlowBenchmarks*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*RebalanceFlowBenchmarks*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*ScenarioBenchmarks*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*ExecutionStrategyBenchmarks*" ``` ### Filtering Options ```bash # Run only FullHit category (UserFlowBenchmarks) -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*FullHit*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*FullHit*" # Run only Rebalance benchmarks -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*RebalanceFlowBenchmarks*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*RebalanceFlowBenchmarks*" # Run specific method -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*User_FullHit_Snapshot*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*User_FullHit_Snapshot*" # Run specific parameter combination (e.g., BaseSpanSize=1000) -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*" -- --filter "*BaseSpanSize_1000*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*" -- --filter "*BaseSpanSize_1000*" ``` ### Managing Execution Time @@ -372,10 +372,10 @@ dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filte With parameterization, total execution time can be significant: **Default configuration:** -- UserFlowBenchmarks: 9 parameters × 8 methods = 72 benchmarks -- RebalanceFlowBenchmarks: 18 parameters × 1 method = 18 benchmarks -- ScenarioBenchmarks: 9 parameters × 2 methods = 18 benchmarks -- ExecutionStrategyBenchmarks: 9 parameters × 2 methods = 18 benchmarks +- UserFlowBenchmarks: 9 parameters ? 8 methods = 72 benchmarks +- RebalanceFlowBenchmarks: 18 parameters ? 1 method = 18 benchmarks +- ScenarioBenchmarks: 9 parameters ? 2 methods = 18 benchmarks +- ExecutionStrategyBenchmarks: 9 parameters ? 2 methods = 18 benchmarks - **Total: ~126 individual benchmarks** - **Estimated time: 3-5 hours** (depending on hardware) @@ -395,13 +395,13 @@ With parameterization, total execution time can be significant: 3. **Run by category:** ```bash # Focus on one flow at a time -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*FullHit*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*FullHit*" ``` 4. **Run single benchmark class:** ```bash # Test specific aspect -dotnet run -c Release --project benchmarks/SlidingWindowCache.Benchmarks --filter "*ScenarioBenchmarks*" +dotnet run -c Release --project benchmarks/Intervals.NET.Caching.Benchmarks --filter "*ScenarioBenchmarks*" ``` --- @@ -445,26 +445,26 @@ var dataSource = new SynchronousDataSource(domain); ### Memory Diagnostics - **Allocated**: Total bytes allocated - **Gen 0/1/2 Collections**: GC pressure indicator -- **LOH**: Large Object Heap allocations (arrays ≥85KB) +- **LOH**: Large Object Heap allocations (arrays ?85KB) --- ## Methodological Guarantees -### ✅ No State Drift +### ? No State Drift Every iteration starts from a clean, deterministic cache state via `[IterationSetup]`. -### ✅ Explicit Rebalance Handling +### ? Explicit Rebalance Handling - Benchmarks that trigger rebalance use `[IterationCleanup]` to wait for completion - NO `WaitForIdleAsync` inside benchmark methods (would contaminate measurements) - Setup phases use `WaitForIdleAsync` to ensure deterministic starting state -### ✅ Clear Separation +### ? Clear Separation - **Read microbenchmarks**: Rebalance disabled, measure read path only - **Partial hit benchmarks**: Rebalance enabled, deterministic overlap, cleanup handles rebalance - **Scenario benchmarks**: Full sequential patterns, cleanup handles stabilization -### ✅ Isolation +### ? Isolation - `RebalanceFlowBenchmarks` uses `SynchronousDataSource` to isolate cache mechanics from I/O - Each benchmark measures ONE architectural characteristic @@ -473,19 +473,19 @@ Every iteration starts from a clean, deterministic cache state via `[IterationSe ## Expected Performance Characteristics ### Snapshot Mode -- ✅ **Best for**: Read-heavy workloads (high read:rebalance ratio) -- ✅ **Strengths**: Zero-allocation reads, fastest read performance -- ❌ **Weaknesses**: Expensive rebalancing, LOH pressure +- ? **Best for**: Read-heavy workloads (high read:rebalance ratio) +- ? **Strengths**: Zero-allocation reads, fastest read performance +- ? **Weaknesses**: Expensive rebalancing, LOH pressure ### CopyOnRead Mode -- ✅ **Best for**: Write-heavy workloads (frequent rebalancing) -- ✅ **Strengths**: Cheap rebalancing, reduced LOH pressure -- ❌ **Weaknesses**: Allocates on every read, slower read performance +- ? **Best for**: Write-heavy workloads (frequent rebalancing) +- ? **Strengths**: Cheap rebalancing, reduced LOH pressure +- ? **Weaknesses**: Allocates on every read, slower read performance ### Sequential Locality -- ✅ **Cache advantage**: Reduces data source calls by 70-80% -- ✅ **Prefetching benefit**: Most requests served from cache -- ✅ **Latency hiding**: Background rebalancing doesn't block reads +- ? **Cache advantage**: Reduces data source calls by 70-80% +- ? **Prefetching benefit**: Most requests served from cache +- ? **Latency hiding**: Background rebalancing doesn't block reads --- @@ -509,11 +509,11 @@ After running benchmarks, results are generated in two locations: ### Results Directory (Committed to Repository) ``` -benchmarks/SlidingWindowCache.Benchmarks/Results/ -├── SlidingWindowCache.Benchmarks.Benchmarks.UserFlowBenchmarks-report-github.md -├── SlidingWindowCache.Benchmarks.Benchmarks.RebalanceFlowBenchmarks-report-github.md -├── SlidingWindowCache.Benchmarks.Benchmarks.ScenarioBenchmarks-report-github.md -└── SlidingWindowCache.Benchmarks.Benchmarks.ExecutionStrategyBenchmarks-report-github.md +benchmarks/Intervals.NET.Caching.Benchmarks/Results/ ++-- Intervals.NET.Caching.Benchmarks.Benchmarks.UserFlowBenchmarks-report-github.md ++-- Intervals.NET.Caching.Benchmarks.Benchmarks.RebalanceFlowBenchmarks-report-github.md ++-- Intervals.NET.Caching.Benchmarks.Benchmarks.ScenarioBenchmarks-report-github.md +L-- Intervals.NET.Caching.Benchmarks.Benchmarks.ExecutionStrategyBenchmarks-report-github.md ``` These markdown reports are checked into version control for: @@ -524,12 +524,12 @@ These markdown reports are checked into version control for: ### BenchmarkDotNet Artifacts (Local Only) ``` BenchmarkDotNet.Artifacts/ -├── results/ -│ ├── *.html (HTML reports) -│ ├── *.md (Markdown reports) -│ └── *.csv (Raw data) -└── logs/ - └── ... (detailed execution logs) ++-- results/ + +-- *.html (HTML reports) + +-- *.md (Markdown reports) + L-- *.csv (Raw data) +L-- logs/ + L-- ... (detailed execution logs) ``` These files are generated locally and excluded from version control (`.gitignore`). diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.ExecutionStrategyBenchmarks-report-github.md b/benchmarks/Intervals.NET.Caching.Benchmarks/Results/Intervals.NET.Caching.Benchmarks.Benchmarks.ExecutionStrategyBenchmarks-report-github.md similarity index 100% rename from benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.ExecutionStrategyBenchmarks-report-github.md rename to benchmarks/Intervals.NET.Caching.Benchmarks/Results/Intervals.NET.Caching.Benchmarks.Benchmarks.ExecutionStrategyBenchmarks-report-github.md diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.RebalanceFlowBenchmarks-report-github.md b/benchmarks/Intervals.NET.Caching.Benchmarks/Results/Intervals.NET.Caching.Benchmarks.Benchmarks.RebalanceFlowBenchmarks-report-github.md similarity index 100% rename from benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.RebalanceFlowBenchmarks-report-github.md rename to benchmarks/Intervals.NET.Caching.Benchmarks/Results/Intervals.NET.Caching.Benchmarks.Benchmarks.RebalanceFlowBenchmarks-report-github.md diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.ScenarioBenchmarks-report-github.md b/benchmarks/Intervals.NET.Caching.Benchmarks/Results/Intervals.NET.Caching.Benchmarks.Benchmarks.ScenarioBenchmarks-report-github.md similarity index 100% rename from benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.ScenarioBenchmarks-report-github.md rename to benchmarks/Intervals.NET.Caching.Benchmarks/Results/Intervals.NET.Caching.Benchmarks.Benchmarks.ScenarioBenchmarks-report-github.md diff --git a/benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.UserFlowBenchmarks-report-github.md b/benchmarks/Intervals.NET.Caching.Benchmarks/Results/Intervals.NET.Caching.Benchmarks.Benchmarks.UserFlowBenchmarks-report-github.md similarity index 100% rename from benchmarks/SlidingWindowCache.Benchmarks/Results/SlidingWindowCache.Benchmarks.Benchmarks.UserFlowBenchmarks-report-github.md rename to benchmarks/Intervals.NET.Caching.Benchmarks/Results/Intervals.NET.Caching.Benchmarks.Benchmarks.UserFlowBenchmarks-report-github.md diff --git a/docs/architecture.md b/docs/architecture.md index 6cdb8f5..0afa407 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -2,13 +2,13 @@ ## Overview -SlidingWindowCache is a range-based cache optimized for sequential access. It serves user requests immediately (User Path) and converges the cache to an optimal window asynchronously (Rebalance Path). +Intervals.NET.Caching is a range-based cache optimized for sequential access. It serves user requests immediately (User Path) and converges the cache to an optimal window asynchronously (Rebalance Path). This document defines the canonical architecture: threading model, single-writer rule, intent model, decision-driven execution, coordination mechanisms, and disposal. ## Motivation -Traditional caches optimize for random access. SlidingWindowCache targets workloads where requests move predictably across a domain (e.g., scrolling, playback, time-series inspection). The goal is: +Traditional caches optimize for random access. Intervals.NET.Caching targets workloads where requests move predictably across a domain (e.g., scrolling, playback, time-series inspection). The goal is: - Fast reads for the requested range. - Background window maintenance (prefetch/trim) without blocking the caller. diff --git a/docs/components/execution.md b/docs/components/execution.md index 6ea3290..5e99bd6 100644 --- a/docs/components/execution.md +++ b/docs/components/execution.md @@ -8,11 +8,11 @@ The execution subsystem performs debounced, cancellable background work and is t | Component | File | Role | |--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|--------------------------------------------------------------------| -| `IRebalanceExecutionController` | `src/SlidingWindowCache/Core/Rebalance/Execution/IRebalanceExecutionController.cs` | Execution serialization contract | -| `TaskBasedRebalanceExecutionController` | `src/SlidingWindowCache/Core/Rebalance/Execution/TaskBasedRebalanceExecutionController.cs` | Default: async task-chaining debounce + per-request cancellation | -| `ChannelBasedRebalanceExecutionController` | `src/SlidingWindowCache/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs` | Optional: channel-based bounded execution queue with backpressure | -| `RebalanceExecutor` | `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` | Sole writer; performs `Rematerialize`; the single-writer authority | -| `CacheDataExtensionService` | `src/SlidingWindowCache/Infrastructure/Services/CacheDataExtensionService.cs` | Incremental data fetching; range gap analysis | +| `IRebalanceExecutionController` | `src/Intervals.NET.Caching/Core/Rebalance/Execution/IRebalanceExecutionController.cs` | Execution serialization contract | +| `TaskBasedRebalanceExecutionController` | `src/Intervals.NET.Caching/Core/Rebalance/Execution/TaskBasedRebalanceExecutionController.cs` | Default: async task-chaining debounce + per-request cancellation | +| `ChannelBasedRebalanceExecutionController` | `src/Intervals.NET.Caching/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs` | Optional: channel-based bounded execution queue with backpressure | +| `RebalanceExecutor` | `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` | Sole writer; performs `Rematerialize`; the single-writer authority | +| `CacheDataExtensionService` | `src/Intervals.NET.Caching/Infrastructure/Services/CacheDataExtensionService.cs` | Incremental data fetching; range gap analysis | ## Execution Controllers @@ -60,7 +60,7 @@ The execution subsystem performs debounced, cancellable background work and is t ## CacheDataExtensionService — Incremental Fetching -**File**: `src/SlidingWindowCache/Infrastructure/Services/CacheDataExtensionService.cs` +**File**: `src/Intervals.NET.Caching/Infrastructure/Services/CacheDataExtensionService.cs` - Computes missing ranges via range algebra: `DesiredRange \ CachedRange` - Fetches only the gaps (not the full desired range) diff --git a/docs/components/intent-management.md b/docs/components/intent-management.md index 61cf45f..6beb1dd 100644 --- a/docs/components/intent-management.md +++ b/docs/components/intent-management.md @@ -8,8 +8,8 @@ Intent management bridges the user path and background work. It receives access | Component | File | Role | |--------------------------------------------|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| -| `IntentController` | `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` | Manages intent lifecycle; runs background processing loop | -| `Intent` | `src/SlidingWindowCache/Core/Rebalance/Intent/Intent.cs` | Carries `RequestedRange` + `AssembledRangeData`; cancellation is owned by execution requests | +| `IntentController` | `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` | Manages intent lifecycle; runs background processing loop | +| `Intent` | `src/Intervals.NET.Caching/Core/Rebalance/Intent/Intent.cs` | Carries `RequestedRange` + `AssembledRangeData`; cancellation is owned by execution requests | ## Execution Contexts diff --git a/docs/components/overview.md b/docs/components/overview.md index 838a0f8..5df8dd2 100644 --- a/docs/components/overview.md +++ b/docs/components/overview.md @@ -2,7 +2,7 @@ ## Overview -This folder documents the internal component set of SlidingWindowCache. It is intentionally split by responsibility and execution context to avoid a single mega-document. +This folder documents the internal component set of Intervals.NET.Caching. It is intentionally split by responsibility and execution context to avoid a single mega-document. ## Motivation @@ -262,196 +262,196 @@ This section bridges architectural invariants (in `docs/invariants.md`) to their Only `RebalanceExecutor` has write access to `CacheState` internal setters. User Path components have read-only references. Internal visibility modifiers prevent external mutations. -- `src/SlidingWindowCache/Core/State/CacheState.cs` — internal setters restrict write access -- `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` — exclusive mutation authority -- `src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs` — read-only access pattern +- `src/Intervals.NET.Caching/Core/State/CacheState.cs` — internal setters restrict write access +- `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` — exclusive mutation authority +- `src/Intervals.NET.Caching/Core/UserPath/UserRequestHandler.cs` — read-only access pattern ### Priority and Cancellation **Invariants**: A.2, A.2a, C.3, F.1a `CancellationTokenSource` coordination between intent publishing and execution. `RebalanceDecisionEngine` validates necessity before triggering cancellation. Multiple checkpoints in execution pipeline check for cancellation. -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — cancellation token lifecycle -- `src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — validation gates cancellation -- `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` — `ThrowIfCancellationRequested` checkpoints +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — cancellation token lifecycle +- `src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — validation gates cancellation +- `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` — `ThrowIfCancellationRequested` checkpoints ### Intent Management and Cancellation **Invariants**: A.2a, C.1, C.4, C.5 `Interlocked.Exchange` replaces previous intent atomically (latest-wins). Single-writer architecture for intent state. Cancellation checked after debounce delay before execution starts. -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — atomic intent replacement +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — atomic intent replacement ### UserRequestHandler Responsibilities **Invariants**: A.5, A.7 Only `UserRequestHandler` has access to `IntentController.PublishIntent`. Its scope is limited to data assembly; no normalization logic. -- `src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs` — exclusive intent publisher -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — internal visibility on publication interface +- `src/Intervals.NET.Caching/Core/UserPath/UserRequestHandler.cs` — exclusive intent publisher +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — internal visibility on publication interface ### Async Execution Model **Invariants**: A.6, G.2 `UserRequestHandler` publishes intent and returns immediately (fire-and-forget). `IRebalanceExecutionController` schedules execution via `Task.Run` or channels. User thread and ThreadPool thread contexts are separated. -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — `ProcessIntentsAsync` runs on background thread -- `src/SlidingWindowCache/Infrastructure/Execution/TaskBasedRebalanceExecutionController.cs` — `Task.Run` scheduling -- `src/SlidingWindowCache/Infrastructure/Execution/ChannelBasedRebalanceExecutionController.cs` — channel-based background execution +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — `ProcessIntentsAsync` runs on background thread +- `src/Intervals.NET.Caching/Infrastructure/Execution/TaskBasedRebalanceExecutionController.cs` — `Task.Run` scheduling +- `src/Intervals.NET.Caching/Infrastructure/Execution/ChannelBasedRebalanceExecutionController.cs` — channel-based background execution ### Atomic Cache Updates **Invariants**: B.2, B.3 Storage strategies build new state before atomic swap. `Volatile.Write` atomically publishes new cache state reference (Snapshot). `CopyOnReadStorage` uses a lock-protected buffer swap instead. `Rematerialize` succeeds completely or not at all. -- `src/SlidingWindowCache/Infrastructure/Storage/SnapshotReadStorage.cs` — `Array.Copy` + `Volatile.Write` -- `src/SlidingWindowCache/Infrastructure/Storage/CopyOnReadStorage.cs` — lock-protected dual-buffer swap (`_lock`) -- `src/SlidingWindowCache/Core/State/CacheState.cs` — `Rematerialize` ensures atomicity +- `src/Intervals.NET.Caching/Infrastructure/Storage/SnapshotReadStorage.cs` — `Array.Copy` + `Volatile.Write` +- `src/Intervals.NET.Caching/Infrastructure/Storage/CopyOnReadStorage.cs` — lock-protected dual-buffer swap (`_lock`) +- `src/Intervals.NET.Caching/Core/State/CacheState.cs` — `Rematerialize` ensures atomicity ### Consistency Under Cancellation **Invariants**: B.3, B.5, F.1b Final cancellation check before applying cache updates. Results applied atomically or discarded entirely. `try-finally` blocks ensure cleanup on cancellation. -- `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` — `ThrowIfCancellationRequested` before `Rematerialize` +- `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` — `ThrowIfCancellationRequested` before `Rematerialize` ### Obsolete Result Prevention **Invariants**: B.6, C.4 Each intent has a unique `CancellationToken`. Execution checks if cancellation is requested before applying results. Only results from the latest non-cancelled intent are applied. -- `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` — cancellation validation before mutation -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — token lifecycle management +- `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` — cancellation validation before mutation +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — token lifecycle management ### Intent Singularity **Invariant**: C.1 `Interlocked.Exchange` ensures exactly one active intent. New intent atomically replaces previous one. At most one pending intent at any time (no queue buildup). -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — `Interlocked.Exchange` for atomic intent replacement +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — `Interlocked.Exchange` for atomic intent replacement ### Cancellation Protocol **Invariant**: C.3 `CancellationToken` passed through the entire pipeline. Multiple checkpoints: before I/O, after I/O, before mutations. Results from cancelled operations are never applied. -- `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` — multiple `ThrowIfCancellationRequested` calls -- `src/SlidingWindowCache/Infrastructure/Services/CacheDataExtensionService.cs` — cancellation token propagated to `IDataSource` +- `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` — multiple `ThrowIfCancellationRequested` calls +- `src/Intervals.NET.Caching/Infrastructure/Services/CacheDataExtensionService.cs` — cancellation token propagated to `IDataSource` ### Early Exit Validation **Invariants**: C.4, D.5 Post-debounce cancellation check before execution. Each validation stage can exit early. All stages must pass for execution to proceed. -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — cancellation check after debounce -- `src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — multi-stage early exit +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — cancellation check after debounce +- `src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — multi-stage early exit ### Serial Execution Guarantee **Invariant**: C.5 Previous execution cancelled before starting new one. Single `IRebalanceExecutionController` instance per cache. Intent processing loop ensures serial execution. -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — sequential intent loop + cancellation of prior execution +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — sequential intent loop + cancellation of prior execution ### Intent Data Contract **Invariant**: C.8e `PublishIntent` signature requires `deliveredData` parameter. `UserRequestHandler` materializes data once, passes it to both user and intent. Compiler enforces data presence. -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — `PublishIntent(requestedRange, deliveredData)` signature -- `src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs` — single data materialization shared between paths +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — `PublishIntent(requestedRange, deliveredData)` signature +- `src/Intervals.NET.Caching/Core/UserPath/UserRequestHandler.cs` — single data materialization shared between paths ### Pure Decision Logic **Invariants**: D.1, D.2 `RebalanceDecisionEngine` has no mutable fields. Decision policies are classes with no side effects. No I/O in decision path. Pure function: `(state, intent, config) → decision`. -- `src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — pure evaluation logic -- `src/SlidingWindowCache/Core/Planning/NoRebalanceSatisfactionPolicy.cs` — stateless struct -- `src/SlidingWindowCache/Core/Planning/ProportionalRangePlanner.cs` — stateless struct +- `src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — pure evaluation logic +- `src/Intervals.NET.Caching/Core/Planning/NoRebalanceSatisfactionPolicy.cs` — stateless struct +- `src/Intervals.NET.Caching/Core/Planning/ProportionalRangePlanner.cs` — stateless struct ### Decision-Execution Separation **Invariant**: D.2 Decision components have no references to mutable state setters. Decision Engine reads `CacheState` but cannot modify it. Decision and Execution interfaces are distinct. -- `src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — read-only state access -- `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` — exclusive write access +- `src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — read-only state access +- `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` — exclusive write access ### Multi-Stage Decision Pipeline **Invariant**: D.5 Five-stage pipeline with early exits. Stage 1: current `NoRebalanceRange` containment (fast path). Stage 2: pending `NoRebalanceRange` validation (thrashing prevention). Stage 3: `DesiredCacheRange` computation. Stage 4: equality check (`DesiredCacheRange == CurrentCacheRange`). Stage 5: execution scheduling (only if all stages pass). -- `src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — complete pipeline implementation +- `src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` — complete pipeline implementation ### Desired Range Computation **Invariants**: E.1, E.2 `ProportionalRangePlanner.Plan(requestedRange, config)` is a pure function — same inputs always produce same output. Never reads `CurrentCacheRange`. Reads configuration from a shared `RuntimeCacheOptionsHolder` at invocation time to support runtime option updates. -- `src/SlidingWindowCache/Core/Planning/ProportionalRangePlanner.cs` — pure range calculation +- `src/Intervals.NET.Caching/Core/Planning/ProportionalRangePlanner.cs` — pure range calculation ### NoRebalanceRange Computation **Invariants**: E.5, E.6 `NoRebalanceRangePlanner.Plan(currentCacheRange)` — pure function of current range + config. Applies threshold percentages as negative expansion. Returns `null` when individual thresholds ≥ 1.0 (no stability zone possible). `WindowCacheOptions` constructor ensures threshold sum ≤ 1.0 at construction time. Reads configuration from a shared `RuntimeCacheOptionsHolder` at invocation time to support runtime option updates. -- `src/SlidingWindowCache/Core/Planning/NoRebalanceRangePlanner.cs` — NoRebalanceRange computation -- `src/SlidingWindowCache/Public/Configuration/WindowCacheOptions.cs` — threshold sum validation +- `src/Intervals.NET.Caching/Core/Planning/NoRebalanceRangePlanner.cs` — NoRebalanceRange computation +- `src/Intervals.NET.Caching/Public/Configuration/WindowCacheOptions.cs` — threshold sum validation ### Cancellation Checkpoints **Invariants**: F.1, F.1a Three checkpoints: before `IDataSource.FetchAsync`, after data fetching, before `Rematerialize`. `OperationCanceledException` propagates to cleanup handlers. -- `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` — multiple checkpoint locations +- `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` — multiple checkpoint locations ### Cache Normalization Operations **Invariant**: F.3 `CacheState.Rematerialize` accepts arbitrary range and data (full replacement). `ICacheStorage` abstraction enables different normalization strategies. -- `src/SlidingWindowCache/Core/State/CacheState.cs` — `Rematerialize` method -- `src/SlidingWindowCache/Infrastructure/Storage/` — storage strategy implementations +- `src/Intervals.NET.Caching/Core/State/CacheState.cs` — `Rematerialize` method +- `src/Intervals.NET.Caching/Infrastructure/Storage/` — storage strategy implementations ### Incremental Data Fetching **Invariant**: F.4 `CacheDataExtensionService.ExtendCacheDataAsync` computes missing ranges via range subtraction (`DesiredRange \ CachedRange`). Fetches only missing subranges via `IDataSource`. -- `src/SlidingWindowCache/Infrastructure/Services/CacheDataExtensionService.cs` — range gap logic in `ExtendCacheDataAsync` +- `src/Intervals.NET.Caching/Infrastructure/Services/CacheDataExtensionService.cs` — range gap logic in `ExtendCacheDataAsync` ### Data Preservation During Expansion **Invariant**: F.5 New data merged with existing via range union. Existing data enumerated and preserved during rematerialization. New data only fills gaps; does not replace existing. -- `src/SlidingWindowCache/Infrastructure/Services/CacheDataExtensionService.cs` — union logic in `ExtendCacheDataAsync` +- `src/Intervals.NET.Caching/Infrastructure/Services/CacheDataExtensionService.cs` — union logic in `ExtendCacheDataAsync` ### I/O Isolation **Invariant**: G.3 `UserRequestHandler` completes before any `IDataSource.FetchAsync` calls in rebalance path. All `IDataSource` interactions happen in `RebalanceExecutor` on a background thread. -- `src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs` — no rebalance-path `IDataSource` calls -- `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` — `IDataSource` calls only in background execution +- `src/Intervals.NET.Caching/Core/UserPath/UserRequestHandler.cs` — no rebalance-path `IDataSource` calls +- `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` — `IDataSource` calls only in background execution ### Activity Counter Ordering **Invariant**: H.1 Activity counter incremented **before** semaphore signal, channel write, or volatile write (strict ordering discipline at all publication sites). -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — increment before `semaphore.Release` -- `src/SlidingWindowCache/Infrastructure/Execution/` — increment before channel write or `Task.Run` +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — increment before `semaphore.Release` +- `src/Intervals.NET.Caching/Infrastructure/Execution/` — increment before channel write or `Task.Run` ### Activity Counter Cleanup **Invariant**: H.2 Decrement in `finally` blocks — unconditional execution regardless of success, failure, or cancellation. -- `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` — `finally` block in `ProcessIntentsAsync` -- `src/SlidingWindowCache/Infrastructure/Execution/` — `finally` blocks in execution controllers +- `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` — `finally` block in `ProcessIntentsAsync` +- `src/Intervals.NET.Caching/Infrastructure/Execution/` — `finally` blocks in execution controllers --- diff --git a/docs/components/public-api.md b/docs/components/public-api.md index 1f040f6..c6d6ac0 100644 --- a/docs/components/public-api.md +++ b/docs/components/public-api.md @@ -2,12 +2,12 @@ ## Overview -This page documents the public surface area of SlidingWindowCache: the cache facade, configuration, data source contract, diagnostics, and public DTOs. +This page documents the public surface area of Intervals.NET.Caching: the cache facade, configuration, data source contract, diagnostics, and public DTOs. ## Facade - `WindowCache`: primary entry point and composition root. - - **File**: `src/SlidingWindowCache/Public/WindowCache.cs` + - **File**: `src/Intervals.NET.Caching/Public/WindowCache.cs` - Constructs and wires all internal components. - Delegates user requests to `UserRequestHandler`. - Exposes `WaitForIdleAsync()` for infrastructure/testing synchronization. @@ -17,7 +17,7 @@ This page documents the public surface area of SlidingWindowCache: the cache fac ### WindowCacheOptions -**File**: `src/SlidingWindowCache/Public/Configuration/WindowCacheOptions.cs` +**File**: `src/Intervals.NET.Caching/Public/Configuration/WindowCacheOptions.cs` **Type**: `record` (immutable, value semantics) @@ -43,7 +43,7 @@ Configuration parameters: ### UserCacheReadMode -**File**: `src/SlidingWindowCache/Public/Configuration/UserCacheReadMode.cs` +**File**: `src/Intervals.NET.Caching/Public/Configuration/UserCacheReadMode.cs` **Type**: `enum` @@ -58,7 +58,7 @@ Configuration parameters: ### IDataSource\ -**File**: `src/SlidingWindowCache/Public/IDataSource.cs` +**File**: `src/Intervals.NET.Caching/Public/IDataSource.cs` **Type**: Interface (user-implemented) @@ -76,7 +76,7 @@ Configuration parameters: ### RangeResult\ -**File**: `src/SlidingWindowCache/Public/DTO/RangeResult.cs` +**File**: `src/Intervals.NET.Caching/Public/DTO/RangeResult.cs` Returned by `GetDataAsync`. Contains three properties: @@ -90,7 +90,7 @@ Returned by `GetDataAsync`. Contains three properties: ### CacheInteraction -**File**: `src/SlidingWindowCache/Public/Dto/CacheInteraction.cs` +**File**: `src/Intervals.NET.Caching/Public/Dto/CacheInteraction.cs` **Type**: `enum` @@ -108,7 +108,7 @@ Classifies how a `GetDataAsync` request was served relative to the current cache ### RangeChunk\ -**File**: `src/SlidingWindowCache/Public/DTO/RangeChunk.cs` +**File**: `src/Intervals.NET.Caching/Public/DTO/RangeChunk.cs` Batch fetch result from `IDataSource`. Contains: - `Range Range` — the range covered by this chunk @@ -118,7 +118,7 @@ Batch fetch result from `IDataSource`. Contains: ### ICacheDiagnostics -**File**: `src/SlidingWindowCache/Public/Instrumentation/ICacheDiagnostics.cs` +**File**: `src/Intervals.NET.Caching/Public/Instrumentation/ICacheDiagnostics.cs` Optional observability interface with 18 event recording methods covering: - User request outcomes (full hit, partial hit, full miss) @@ -139,7 +139,7 @@ Optional observability interface with 18 event recording methods covering: ### WindowCacheConsistencyExtensions -**File**: `src/SlidingWindowCache/Public/WindowCacheConsistencyExtensions.cs` +**File**: `src/Intervals.NET.Caching/Public/WindowCacheConsistencyExtensions.cs` **Type**: `static class` (extension methods on `IWindowCache`) @@ -202,7 +202,7 @@ Three classes support building layered cache stacks where each layer's data sour ### WindowCacheDataSourceAdapter\ -**File**: `src/SlidingWindowCache/Public/WindowCacheDataSourceAdapter.cs` +**File**: `src/Intervals.NET.Caching/Public/WindowCacheDataSourceAdapter.cs` **Type**: `sealed class` implementing `IDataSource` @@ -213,7 +213,7 @@ Wraps an `IWindowCache` as an `IDataSource`, allowing any `WindowCache` to act a ### LayeredWindowCache\ -**File**: `src/SlidingWindowCache/Public/LayeredWindowCache.cs` +**File**: `src/Intervals.NET.Caching/Public/LayeredWindowCache.cs` **Type**: `sealed class` implementing `IWindowCache` and `IAsyncDisposable` @@ -227,7 +227,7 @@ Typically created via `LayeredWindowCacheBuilder.Build()` rather than directly. ### LayeredWindowCacheBuilder\ -**File**: `src/SlidingWindowCache/Public/Cache/LayeredWindowCacheBuilder.cs` +**File**: `src/Intervals.NET.Caching/Public/Cache/LayeredWindowCacheBuilder.cs` **Type**: `sealed class` — fluent builder diff --git a/docs/components/rebalance-path.md b/docs/components/rebalance-path.md index cf379b4..b337d24 100644 --- a/docs/components/rebalance-path.md +++ b/docs/components/rebalance-path.md @@ -12,13 +12,13 @@ Rebalancing is expensive: it involves debounce delays, optional I/O, and atomic | Component | File | Role | |---------------------------------------------------------|------------------------------------------------------------------------------------|--------------------------------------------------------------| -| `IntentController` | `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` | Background loop; decision orchestration; cancellation | -| `RebalanceDecisionEngine` | `src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` | **Sole authority** for rebalance necessity; 5-stage pipeline | -| `NoRebalanceSatisfactionPolicy` | `src/SlidingWindowCache/Core/Rebalance/Decision/NoRebalanceSatisfactionPolicy.cs` | Stages 1 & 2: NoRebalanceRange containment checks | -| `ProportionalRangePlanner` | `src/SlidingWindowCache/Core/Planning/ProportionalRangePlanner.cs` | Stage 3: desired cache range computation | -| `NoRebalanceRangePlanner` | `src/SlidingWindowCache/Core/Planning/NoRebalanceRangePlanner.cs` | Stage 3: desired NoRebalanceRange computation | -| `IRebalanceExecutionController` | `src/SlidingWindowCache/Core/Rebalance/Execution/IRebalanceExecutionController.cs` | Debounce + single-flight execution contract | -| `RebalanceExecutor` | `src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs` | Sole writer; performs `Rematerialize` | +| `IntentController` | `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` | Background loop; decision orchestration; cancellation | +| `RebalanceDecisionEngine` | `src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecisionEngine.cs` | **Sole authority** for rebalance necessity; 5-stage pipeline | +| `NoRebalanceSatisfactionPolicy` | `src/Intervals.NET.Caching/Core/Rebalance/Decision/NoRebalanceSatisfactionPolicy.cs` | Stages 1 & 2: NoRebalanceRange containment checks | +| `ProportionalRangePlanner` | `src/Intervals.NET.Caching/Core/Planning/ProportionalRangePlanner.cs` | Stage 3: desired cache range computation | +| `NoRebalanceRangePlanner` | `src/Intervals.NET.Caching/Core/Planning/NoRebalanceRangePlanner.cs` | Stage 3: desired NoRebalanceRange computation | +| `IRebalanceExecutionController` | `src/Intervals.NET.Caching/Core/Rebalance/Execution/IRebalanceExecutionController.cs` | Debounce + single-flight execution contract | +| `RebalanceExecutor` | `src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs` | Sole writer; performs `Rematerialize` | See also the split component pages for deeper detail: diff --git a/docs/components/state-and-storage.md b/docs/components/state-and-storage.md index af6cc88..fe11040 100644 --- a/docs/components/state-and-storage.md +++ b/docs/components/state-and-storage.md @@ -8,14 +8,14 @@ State and storage define how cached data is held, read, and published. `CacheSta | Component | File | Role | |-----------------------------------------------|------------------------------------------------------------------------|-----------------------------------------------------| -| `CacheState` | `src/SlidingWindowCache/Core/State/CacheState.cs` | Shared mutable state; the single coordination point | -| `ICacheStorage` | `src/SlidingWindowCache/Infrastructure/Storage/ICacheStorage.cs` | Internal storage contract | -| `SnapshotReadStorage` | `src/SlidingWindowCache/Infrastructure/Storage/SnapshotReadStorage.cs` | Array-based; zero-allocation reads | -| `CopyOnReadStorage` | `src/SlidingWindowCache/Infrastructure/Storage/CopyOnReadStorage.cs` | List-based; cheap rematerialization | +| `CacheState` | `src/Intervals.NET.Caching/Core/State/CacheState.cs` | Shared mutable state; the single coordination point | +| `ICacheStorage` | `src/Intervals.NET.Caching/Infrastructure/Storage/ICacheStorage.cs` | Internal storage contract | +| `SnapshotReadStorage` | `src/Intervals.NET.Caching/Infrastructure/Storage/SnapshotReadStorage.cs` | Array-based; zero-allocation reads | +| `CopyOnReadStorage` | `src/Intervals.NET.Caching/Infrastructure/Storage/CopyOnReadStorage.cs` | List-based; cheap rematerialization | ## CacheState -**File**: `src/SlidingWindowCache/Core/State/CacheState.cs` +**File**: `src/Intervals.NET.Caching/Core/State/CacheState.cs` `CacheState` is shared by reference across `UserRequestHandler`, `RebalanceDecisionEngine`, and `RebalanceExecutor`. It holds: diff --git a/docs/components/user-path.md b/docs/components/user-path.md index 95888b3..4c405a1 100644 --- a/docs/components/user-path.md +++ b/docs/components/user-path.md @@ -12,10 +12,10 @@ User requests must not block on background optimization. The user path does the | Component | File | Role | |-----------------------------------------------------|--------------------------------------------------------------------------------|-----------------------------------------------------| -| `WindowCache` | `src/SlidingWindowCache/Public/WindowCache.cs` | Public facade; delegates to `UserRequestHandler` | -| `UserRequestHandler` | `src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs` | Internal user-path logic; sole publisher of intents | -| `CacheDataExtensionService` | `src/SlidingWindowCache/Core/Rebalance/Execution/CacheDataExtensionService.cs` | Assembles requested range from cache + IDataSource | -| `IntentController` | `src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs` | Publish-side only from user path | +| `WindowCache` | `src/Intervals.NET.Caching/Public/WindowCache.cs` | Public facade; delegates to `UserRequestHandler` | +| `UserRequestHandler` | `src/Intervals.NET.Caching/Core/UserPath/UserRequestHandler.cs` | Internal user-path logic; sole publisher of intents | +| `CacheDataExtensionService` | `src/Intervals.NET.Caching/Core/Rebalance/Execution/CacheDataExtensionService.cs` | Assembles requested range from cache + IDataSource | +| `IntentController` | `src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs` | Publish-side only from user path | ## Execution Context diff --git a/docs/diagnostics.md b/docs/diagnostics.md index 952e5fc..3c70b31 100644 --- a/docs/diagnostics.md +++ b/docs/diagnostics.md @@ -1,4 +1,4 @@ -# Cache Diagnostics - Instrumentation and Observability +# Cache Diagnostics - Instrumentation and Observability ## Overview @@ -100,19 +100,19 @@ Console.WriteLine($"Rebalances: {diagnostics.RebalanceExecutionCompleted}"); ``` **Features:** -- ✅ Thread-safe (uses `Interlocked.Increment`) -- ✅ Low overhead (integer increment per event) -- ✅ Read-only properties for all 18 counters (17 counters + 1 exception event) -- ✅ `Reset()` method for test isolation -- ✅ Instance-based (multiple caches can have separate diagnostics) -- ⚠️ **Warning**: Default implementation only writes RebalanceExecutionFailed to Debug output +- ? Thread-safe (uses `Interlocked.Increment`) +- ? Low overhead (integer increment per event) +- ? Read-only properties for all 18 counters (17 counters + 1 exception event) +- ? `Reset()` method for test isolation +- ? Instance-based (multiple caches can have separate diagnostics) +- ?? **Warning**: Default implementation only writes RebalanceExecutionFailed to Debug output **Use for:** - Testing and validation - Development and debugging - Production monitoring (acceptable overhead) -**⚠️ CRITICAL: Production Usage Requirement** +**?? CRITICAL: Production Usage Requirement** The default `EventCounterCacheDiagnostics` implementation of `RebalanceExecutionFailed` only writes to Debug output. **For production use, you MUST create a custom implementation that logs to your logging infrastructure.** @@ -148,10 +148,10 @@ Rebalance operations run in fire-and-forget background tasks. When exceptions oc 3. Without logging, failures are **completely silent** Ignoring this event means: -- ❌ Data source errors go unnoticed -- ❌ Cache stops rebalancing with no indication -- ❌ Performance degrades silently -- ❌ No diagnostics for troubleshooting +- ? Data source errors go unnoticed +- ? Cache stops rebalancing with no indication +- ? Performance degrades silently +- ? No diagnostics for troubleshooting **Recommended production implementation:** - Always log with full exception details (message, stack trace, inner exceptions) @@ -174,10 +174,10 @@ var cache = new WindowCache( ``` **Features:** -- ✅ **Absolute zero overhead** - methods are empty and get inlined/eliminated -- ✅ No memory allocations -- ✅ No performance impact whatsoever -- ✅ Default when diagnostics not provided +- ? **Absolute zero overhead** - methods are empty and get inlined/eliminated +- ? No memory allocations +- ? No performance impact whatsoever +- ? Default when diagnostics not provided **Use for:** - Production deployments where diagnostics are not needed @@ -194,7 +194,7 @@ var cache = new WindowCache( **Tracks:** Completion of user request (data returned to caller) **Location:** `UserRequestHandler.HandleRequestAsync` (final step, inside `!exceptionOccurred` block) **Scenarios:** All user scenarios (U1-U5) and physical boundary miss (full vacuum) -**Fires when:** No exception occurred — regardless of whether a rebalance intent was published +**Fires when:** No exception occurred regardless of whether a rebalance intent was published **Does NOT fire when:** An exception propagated out of `HandleRequestAsync` **Interpretation:** Total number of user requests that completed without exception (including boundary misses where `Range == null`) @@ -346,30 +346,30 @@ Assert.Equal(1, diagnostics.DataSourceFetchMissingSegments); --- #### `DataSegmentUnavailable()` -**Tracks:** A fetched chunk returned a `null` Range — the requested segment does not exist in the data source +**Tracks:** A fetched chunk returned a `null` Range the requested segment does not exist in the data source **Location:** `CacheDataExtensionService.UnionAll` (when a `RangeChunk.Range` is null) -**Context:** User Thread (Partial Cache Hit — Scenario 3) **and** Background Thread (Rebalance Execution) +**Context:** User Thread (Partial Cache Hit Scenario 3) **and** Background Thread (Rebalance Execution) **Invariants:** G.5 (IDataSource Boundary Semantics), A.12b (Cache Contiguity) **Interpretation:** Physical boundary encountered; the unavailable segment is silently skipped to preserve cache contiguity **Typical Scenarios:** -- Database with min/max ID bounds — extension tries to expand beyond available range -- Time-series data with temporal limits — requesting future/past data not yet/no longer available -- Paginated API with maximum pages — attempting to fetch beyond last page +- Database with min/max ID bounds extension tries to expand beyond available range +- Time-series data with temporal limits requesting future/past data not yet/no longer available +- Paginated API with maximum pages attempting to fetch beyond last page **Important:** This is purely informational. The system gracefully skips unavailable segments during `UnionAll`, and cache contiguity is preserved. No action is required by the caller. **Example Usage:** ```csharp // BoundedDataSource has data in [1000, 9999] -// Request [500, 1500] overlaps lower boundary — partial cache hit fetches [500, 999] which returns null +// Request [500, 1500] overlaps lower boundary partial cache hit fetches [500, 999] which returns null var result = await cache.GetDataAsync(Range.Closed(500, 1500), ct); await cache.WaitForIdleAsync(); // At least one unavailable segment was encountered during extension Assert.True(diagnostics.DataSegmentUnavailable >= 1); -// Cache contiguity preserved — result is the intersection of requested and available +// Cache contiguity preserved result is the intersection of requested and available Assert.Equal(Range.Closed(1000, 1500), result.Range); ``` @@ -395,7 +395,7 @@ Assert.Equal(1, diagnostics.RebalanceIntentPublished); #### `RebalanceIntentCancelled()` **Tracks:** Intent cancellation before or during execution -**Location:** `IntentController.ProcessIntentsAsync` (background loop — when new intent supersedes pending intent) +**Location:** `IntentController.ProcessIntentsAsync` (background loop when new intent supersedes pending intent) **Invariants:** A.2 (User Path priority), A.2a (User cancels rebalance), C.4 (Obsolete intent doesn't start) **Interpretation:** Single-flight execution - new request cancels previous intent @@ -473,12 +473,12 @@ Assert.True(diagnostics.RebalanceExecutionCancelled >= 1); --- -#### `RebalanceExecutionFailed(Exception ex)` ⚠️ CRITICAL +#### `RebalanceExecutionFailed(Exception ex)` ?? CRITICAL **Tracks:** Rebalance execution failure due to exception **Location:** `RebalanceExecutor.ExecuteAsync` (catch `Exception`) **Interpretation:** **CRITICAL ERROR** - background rebalance operation failed -**⚠️ WARNING: This event MUST be handled in production applications** +**?? WARNING: This event MUST be handled in production applications** Rebalance operations execute in fire-and-forget background tasks. When an exception occurs: 1. The exception is caught and this event is recorded @@ -486,11 +486,11 @@ Rebalance operations execute in fire-and-forget background tasks. When an except 3. The cache continues serving user requests but rebalancing stops **Consequences of ignoring this event:** -- ❌ Silent failures in background operations -- ❌ Cache stops rebalancing without any indication -- ❌ Performance degrades with no diagnostics -- ❌ Data source errors go completely unnoticed -- ❌ Impossible to troubleshoot production issues +- ? Silent failures in background operations +- ? Cache stops rebalancing without any indication +- ? Performance degrades with no diagnostics +- ? Data source errors go completely unnoticed +- ? Impossible to troubleshoot production issues **Minimum requirement: Always log** @@ -572,7 +572,7 @@ Assert.Equal(1, diagnostics.RebalanceExecutionFailed); ### Rebalance Skip / Schedule Optimization Events #### `RebalanceSkippedCurrentNoRebalanceRange()` -**Tracks:** Rebalance skipped — last requested position is within the current `NoRebalanceRange` +**Tracks:** Rebalance skipped last requested position is within the current `NoRebalanceRange` **Location:** `RebalanceDecisionEngine.Evaluate` (Stage 1 early exit) **Scenarios:** Decision Scenario D1 (inside current no-rebalance threshold) **Invariants:** D.3 (No rebalance if inside NoRebalanceRange), C.8b (RebalanceSkippedNoRebalanceRange counter semantics) @@ -598,9 +598,9 @@ Assert.True(diagnostics.RebalanceSkippedCurrentNoRebalanceRange >= 1); --- #### `RebalanceSkippedPendingNoRebalanceRange()` -**Tracks:** Rebalance skipped — last requested position is within the *pending* (desired) `NoRebalanceRange` of an already-scheduled execution +**Tracks:** Rebalance skipped last requested position is within the *pending* (desired) `NoRebalanceRange` of an already-scheduled execution **Location:** `RebalanceDecisionEngine.Evaluate` (Stage 2 early exit) -**Scenarios:** Decision Scenario D2 (pending rebalance covers the request — anti-thrashing) +**Scenarios:** Decision Scenario D2 (pending rebalance covers the request anti-thrashing) **Invariants:** D.2a (No rebalance if pending rebalance covers request) **Example Usage:** @@ -608,7 +608,7 @@ Assert.True(diagnostics.RebalanceSkippedCurrentNoRebalanceRange >= 1); // Request 1 publishes intent and schedules execution var _ = cache.GetDataAsync(Range.Closed(100, 200), ct); -// Request 2 (before debounce completes) — pending execution already covers it +// Request 2 (before debounce completes) pending execution already covers it await cache.GetDataAsync(Range.Closed(110, 190), ct); await cache.WaitForIdleAsync(); @@ -637,7 +637,7 @@ Assert.True(diagnostics.RebalanceSkippedSameRange >= 0); // May or may not occur #### `RebalanceScheduled()` **Tracks:** Rebalance execution successfully scheduled after all decision stages approved -**Location:** `IntentController.ProcessIntentsAsync` (Stage 5 — after `RebalanceDecisionEngine` returns `ShouldSchedule=true`) +**Location:** `IntentController.ProcessIntentsAsync` (Stage 5 after `RebalanceDecisionEngine` returns `ShouldSchedule=true`) **Scenarios:** Decision Scenario D4 (rebalance required) **Invariant:** D.5 (Rebalance triggered only if confirmed necessary) @@ -793,7 +793,7 @@ Omit the second argument (or pass `null`) to use the default `NoOpDiagnostics` f ### What Each Layer's Diagnostics Report Because each layer is a fully independent `WindowCache`, every `ICacheDiagnostics` event has -the same meaning as documented in the single-cache sections above — but scoped to that layer: +the same meaning as documented in the single-cache sections above but scoped to that layer: | Event | Meaning in a layered context | |-------------------------------------------|------------------------------------------------------------------------------------| @@ -804,7 +804,7 @@ the same meaning as documented in the single-cache sections above — but scoped | `DataSourceFetchSingleRange` | This layer called the layer below (via the adapter) for a single range | | `DataSourceFetchMissingSegments` | This layer called the layer below for gap-filling segments only | | `RebalanceExecutionCompleted` | This layer completed a background rebalance (window expansion/shrink) | -| `RebalanceSkippedCurrentNoRebalanceRange` | This layer's rebalance was skipped — still within its stability zone | +| `RebalanceSkippedCurrentNoRebalanceRange` | This layer's rebalance was skipped still within its stability zone | ### Detecting Cascading Rebalances @@ -813,7 +813,7 @@ inner layer that fall outside the inner layer's `NoRebalanceRange`, causing the to also rebalance. Under correct configuration this should be rare. Under misconfiguration it becomes continuous and defeats the purpose of layering. -**Primary indicator — compare rebalance completion counts:** +**Primary indicator compare rebalance completion counts:** ```csharp // After a sustained sequential access session: @@ -824,10 +824,10 @@ var l2Rate = l2Diagnostics.RebalanceExecutionCompleted; // l2Rate should be << l1Rate for normal sequential access // Unhealthy: L2 rebalances nearly as often as L1 -// l2Rate ≈ l1Rate → cascading rebalance thrashing +// l2Rate ? l1Rate > cascading rebalance thrashing ``` -**Secondary confirmation — check skip counts on the inner layer:** +**Secondary confirmation check skip counts on the inner layer:** ```csharp // Under correct configuration, the inner layer's Decision Engine @@ -836,7 +836,7 @@ var l2Rate = l2Diagnostics.RebalanceExecutionCompleted; var l2SkippedStage1 = l2Diagnostics.RebalanceSkippedCurrentNoRebalanceRange; // Healthy ratio: l2SkippedStage1 >> l2Rate -// Unhealthy ratio: l2SkippedStage1 ≈ 0 while l2Rate is high +// Unhealthy ratio: l2SkippedStage1 ? 0 while l2Rate is high ``` **Confirming the data source is being hit too frequently:** @@ -851,15 +851,15 @@ var dataSourceFetches = lInnerDiagnostics.DataSourceFetchMissingSegments **Resolution checklist when cascading is detected:** -1. Increase inner layer `leftCacheSize` and `rightCacheSize` to 5–10× the outer layer's values -2. Set inner layer `leftThreshold` and `rightThreshold` to 0.2–0.3 +1. Increase inner layer `leftCacheSize` and `rightCacheSize` to 510? the outer layer's values +2. Set inner layer `leftThreshold` and `rightThreshold` to 0.20.3 3. Re-run the access pattern and verify `l2.RebalanceSkippedCurrentNoRebalanceRange` dominates 4. See `docs/architecture.md` (Cascading Rebalance Behavior) and `docs/scenarios.md` (L6, L7) for a full explanation of the mechanics and the anti-pattern ``` l2Diagnostics.UserRequestFullCacheHit / l2Diagnostics.UserRequestServed ``` -A low hit rate on the inner layer means L1 is frequently delegating to L2 — consider +A low hit rate on the inner layer means L1 is frequently delegating to L2 consider increasing L2's buffer sizes (`leftCacheSize` / `rightCacheSize`). **Outer layer hit rate:** @@ -888,7 +888,7 @@ access pattern has high variability. Consider loosening L1's thresholds or widen - **Always handle `RebalanceExecutionFailed` on each layer.** Background rebalance failures on any layer are silent without a proper implementation. See the production requirements - section above — they apply to every layer independently. + section above they apply to every layer independently. - **Use separate `EventCounterCacheDiagnostics` instances per layer** during development and staging to establish baseline metrics. In production, replace with custom @@ -904,5 +904,5 @@ access pattern has high variability. Consider loosening L1's thresholds or widen - **[Invariants](invariants.md)** - System invariants tracked by diagnostics - **[Scenarios](scenarios.md)** - User/Decision/Rebalance scenarios referenced in event descriptions -- **[Invariant Test Suite](../tests/SlidingWindowCache.Invariants.Tests/README.md)** - Examples of diagnostic usage in tests +- **[Invariant Test Suite](../tests/Intervals.NET.Caching.Invariants.Tests/README.md)** - Examples of diagnostic usage in tests - **[Components](components/overview.md)** - Component locations where events are recorded diff --git a/docs/glossary.md b/docs/glossary.md index 856dd63..89844f8 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -1,6 +1,6 @@ # Glossary -Canonical definitions for SlidingWindowCache terms. This is a reference, not a tutorial. +Canonical definitions for Intervals.NET.Caching terms. This is a reference, not a tutorial. Recommended reading order: @@ -160,13 +160,13 @@ Layer - A single `WindowCache` instance in a layered cache stack. Layers are ordered by proximity to the user: L1 = outermost (user-facing), L2 = next inner, Lₙ = innermost (closest to the real data source). WindowCacheDataSourceAdapter -- Adapts an `IWindowCache` to the `IDataSource` interface, enabling it to act as the backing store for an outer `WindowCache`. This is the composition point for building layered caches. The adapter does not own the inner cache; ownership is managed by `LayeredWindowCache`. See `src/SlidingWindowCache/Public/WindowCacheDataSourceAdapter.cs`. +- Adapts an `IWindowCache` to the `IDataSource` interface, enabling it to act as the backing store for an outer `WindowCache`. This is the composition point for building layered caches. The adapter does not own the inner cache; ownership is managed by `LayeredWindowCache`. See `src/Intervals.NET.Caching/Public/WindowCacheDataSourceAdapter.cs`. LayeredWindowCacheBuilder -- Fluent builder that wires `WindowCache` layers into a `LayeredWindowCache`. Obtain an instance via `WindowCacheBuilder.Layered(dataSource, domain)`. Layers are added bottom-up (deepest/innermost first, user-facing last). Each `AddLayer` call accepts either a pre-built `WindowCacheOptions` or an `Action` for inline configuration. `Build()` returns `IWindowCache<>` (concrete type: `LayeredWindowCache<>`). See `src/SlidingWindowCache/Public/Cache/LayeredWindowCacheBuilder.cs`. +- Fluent builder that wires `WindowCache` layers into a `LayeredWindowCache`. Obtain an instance via `WindowCacheBuilder.Layered(dataSource, domain)`. Layers are added bottom-up (deepest/innermost first, user-facing last). Each `AddLayer` call accepts either a pre-built `WindowCacheOptions` or an `Action` for inline configuration. `Build()` returns `IWindowCache<>` (concrete type: `LayeredWindowCache<>`). See `src/Intervals.NET.Caching/Public/Cache/LayeredWindowCacheBuilder.cs`. LayeredWindowCache -- A thin `IWindowCache` wrapper that owns a stack of `WindowCache` layers. Delegates `GetDataAsync` to the outermost layer. `WaitForIdleAsync` awaits all layers sequentially, outermost to innermost, ensuring full-stack convergence (required for correct behavior of `GetDataAndWaitForIdleAsync`). Disposes all layers outermost-first on `DisposeAsync`. Exposes `LayerCount` and `Layers`. See `src/SlidingWindowCache/Public/LayeredWindowCache.cs`. +- A thin `IWindowCache` wrapper that owns a stack of `WindowCache` layers. Delegates `GetDataAsync` to the outermost layer. `WaitForIdleAsync` awaits all layers sequentially, outermost to innermost, ensuring full-stack convergence (required for correct behavior of `GetDataAndWaitForIdleAsync`). Disposes all layers outermost-first on `DisposeAsync`. Exposes `LayerCount` and `Layers`. See `src/Intervals.NET.Caching/Public/LayeredWindowCache.cs`. ## Storage And Materialization @@ -210,7 +210,7 @@ RuntimeOptionsValidator - Internal static helper class that contains the shared validation logic for cache sizes and thresholds. - Used by both `WindowCacheOptions` and `RuntimeCacheOptions` to avoid duplicated validation rules. - Validates: cache sizes ≥ 0, individual thresholds in [0, 1], threshold sum ≤ 1.0 when both thresholds are provided. -- See `src/SlidingWindowCache/Core/State/RuntimeOptionsValidator.cs`. +- See `src/Intervals.NET.Caching/Core/State/RuntimeOptionsValidator.cs`. RuntimeCacheOptions - Internal immutable snapshot of the runtime-updatable subset of cache configuration: `LeftCacheSize`, `RightCacheSize`, `LeftThreshold`, `RightThreshold`, `DebounceDelay`. @@ -223,7 +223,7 @@ RuntimeOptionsSnapshot - Obtained via `IWindowCache.CurrentRuntimeOptions`. - Immutable — a snapshot of values at the moment the property was read. Subsequent `UpdateRuntimeOptions` calls do not affect previously obtained snapshots. - Constructor is `internal`; created only via `RuntimeCacheOptions.ToSnapshot()`. -- See `src/SlidingWindowCache/Public/Configuration/RuntimeOptionsSnapshot.cs`. +- See `src/Intervals.NET.Caching/Public/Configuration/RuntimeOptionsSnapshot.cs`. RuntimeCacheOptionsHolder - Internal volatile wrapper that holds the current `RuntimeCacheOptions` snapshot. diff --git a/docs/invariants.md b/docs/invariants.md index 97ccb13..b1055d9 100644 --- a/docs/invariants.md +++ b/docs/invariants.md @@ -833,7 +833,7 @@ When activity counter reaches zero (idle state), NO work exists in any of these **Rationale:** Ensures idle detection accurately reflects all enqueued work, preventing premature idle signals. -**Implementation:** See `src/SlidingWindowCache/Infrastructure/Concurrency/AsyncActivityCounter.cs`. +**Implementation:** See `src/Intervals.NET.Caching/Infrastructure/Concurrency/AsyncActivityCounter.cs`. - 🔵 **[Architectural — Enforced by call site ordering]** ### H.2: Decrement-After-Completion Invariant @@ -852,7 +852,7 @@ Activity counter accurately reflects active work count at all times: **Rationale:** Ensures `WaitForIdleAsync()` will eventually complete by preventing counter leaks on any execution path. -**Implementation:** See `src/SlidingWindowCache/Infrastructure/Concurrency/AsyncActivityCounter.cs`. +**Implementation:** See `src/Intervals.NET.Caching/Infrastructure/Concurrency/AsyncActivityCounter.cs`. - 🔵 **[Architectural — Enforced by finally blocks]** **H.3** 🟡 **[Conceptual — Eventual consistency design]** **"Was Idle" Semantics:** @@ -971,7 +971,7 @@ Complete trace demonstrating both invariants in current architecture: **Rationale:** Prevents mid-cycle inconsistencies (e.g., a planner using new `LeftCacheSize` with old `RightCacheSize`). Cycles are short; the next cycle reflects the update. -**Implementation:** `RuntimeCacheOptionsHolder.Update` in `src/SlidingWindowCache/Core/State/RuntimeCacheOptionsHolder.cs`. +**Implementation:** `RuntimeCacheOptionsHolder.Update` in `src/Intervals.NET.Caching/Core/State/RuntimeCacheOptionsHolder.cs`. **I.3** 🔵 **[Architectural]** `UpdateRuntimeOptions` on a disposed cache **always throws `ObjectDisposedException`**. diff --git a/docs/scenarios.md b/docs/scenarios.md index 73aea41..26fe1bc 100644 --- a/docs/scenarios.md +++ b/docs/scenarios.md @@ -2,7 +2,7 @@ ## Overview -This document describes the temporal behavior of SlidingWindowCache: what happens over time when user requests occur, decisions are evaluated, and background executions run. +This document describes the temporal behavior of Intervals.NET.Caching: what happens over time when user requests occur, decisions are evaluated, and background executions run. ## Motivation diff --git a/docs/storage-strategies.md b/docs/storage-strategies.md index 7694c3c..8faf71b 100644 --- a/docs/storage-strategies.md +++ b/docs/storage-strategies.md @@ -1,6 +1,6 @@ -# Sliding Window Cache - Storage Strategies Guide +# Sliding Window Cache - Storage Strategies Guide -> **📖 For component implementation details, see:** +> **?? For component implementation details, see:** > - `docs/components/infrastructure.md` - Storage components in context ## Overview @@ -35,12 +35,12 @@ This guide explains when to use each strategy and their trade-offs. ### Design ``` -┌─────────────────────────────────┐ -│ SnapshotReadStorage │ -├─────────────────────────────────┤ -│ _storage: TData[] │ ← Single array -│ Range: Range │ -└─────────────────────────────────┘ +┌──────────────────────────────────┐ +│ SnapshotReadStorage │ +├──────────────────────────────────┤ +│ _storage: TData[] │ < Single array +│ Range: Range │ +└──────────────────────────────────┘ ``` ### Behavior @@ -60,10 +60,10 @@ return new ReadOnlyMemory(_storage, offset, length); // Zero allocation ### Characteristics -- ✅ **Zero-allocation reads**: Returns `ReadOnlyMemory` slice over internal array -- ✅ **Simple and predictable**: Single buffer, no complexity -- ❌ **Expensive rematerialization**: Always allocates new array (even if size unchanged) -- ❌ **LOH pressure**: Arrays ≥85KB go to Large Object Heap (no compaction) +- ? **Zero-allocation reads**: Returns `ReadOnlyMemory` slice over internal array +- ? **Simple and predictable**: Single buffer, no complexity +- ? **Expensive rematerialization**: Always allocates new array (even if size unchanged) +- ? **LOH pressure**: Arrays ?85KB go to Large Object Heap (no compaction) ### When to Use @@ -79,7 +79,7 @@ return new ReadOnlyMemory(_storage, offset, length); // Zero allocation var options = new WindowCacheOptions( leftCacheSize: 0.5, rightCacheSize: 0.5, - readMode: UserCacheReadMode.Snapshot // ← Zero-allocation reads + readMode: UserCacheReadMode.Snapshot // < Zero-allocation reads ); var cache = new WindowCache( @@ -89,7 +89,7 @@ var cache = new WindowCache( for (int i = 0; i < 100; i++) { var data = await cache.GetDataAsync(Range.Closed(i, i + 20), ct); - // ← Zero allocation on each read + // < Zero allocation on each read } ``` @@ -100,34 +100,34 @@ for (int i = 0; i < 100; i++) ### Design ``` -┌─────────────────────────────────┐ -│ CopyOnReadStorage │ -├─────────────────────────────────┤ -│ _activeStorage: List │ ← Active (immutable during reads) -│ _stagingBuffer: List │ ← Staging (write-only during rematerialize) -│ Range: Range │ -└─────────────────────────────────┘ +┌──────────────────────────────────┐ +│ CopyOnReadStorage │ +├──────────────────────────────────┤ +│ _activeStorage: List │ < Active (immutable during reads) +│ _stagingBuffer: List │ < Staging (write-only during rematerialize) +│ Range: Range │ +└──────────────────────────────────┘ Rematerialize Flow: -┌──────────────┐ ┌──────────────┐ -│ Active │ │ Staging │ -│ [old data] │ │ [empty] │ -└──────────────┘ └──────────────┘ - ↓ Clear() preserves capacity - ┌──────────────┐ - │ Staging │ - │ [] │ - └──────────────┘ - ↓ AddRange(newData) - ┌──────────────┐ - │ Staging │ - │ [new data] │ - └──────────────┘ - ↓ Swap references -┌──────────────┐ ┌──────────────┐ -│ Active │ ←── │ Staging │ -│ [new data] │ │ [old data] │ -└──────────────┘ └──────────────┘ +┌───────────────┐ ┌───────────────┐ +│ Active │ │ Staging │ +│ [old data] │ │ [empty] │ +└───────────────┘ └───────────────┘ + v Clear() preserves capacity + ┌───────────────┐ + │ Staging │ + │ [] │ + └───────────────┘ + v AddRange(newData) + ┌───────────────┐ + │ Staging │ + │ [new data] │ + └───────────────┘ + v Swap references +┌───────────────┐ ┌───────────────┐ +│ Active │ <-- │ Staging │ +│ [new data] │ │ [old data] │ +└───────────────┘ └───────────────┘ ``` ### Staging Buffer Pattern @@ -176,14 +176,14 @@ lock (_lock) ### Characteristics -- ✅ **Cheap rematerialization**: Reuses capacity, no allocation if size ≤ capacity -- ✅ **No LOH pressure**: List growth strategy avoids large single allocations -- ✅ **Correct enumeration**: Staging buffer prevents corruption during LINQ-derived expansion -- ✅ **Amortized performance**: Cost decreases over time as capacity stabilizes -- ✅ **Safe concurrent access**: `Read()`, `Rematerialize()`, and `ToRangeData()` share a lock; mid-swap observation is impossible -- ❌ **Expensive reads**: Each read acquires a lock, allocates, and copies -- ❌ **Higher memory**: Two buffers instead of one -- ⚠️ **Lock contention**: Reader briefly blocks if rematerialization is in progress (bounded to a single `Rematerialize()` call duration) +- ? **Cheap rematerialization**: Reuses capacity, no allocation if size ? capacity +- ? **No LOH pressure**: List growth strategy avoids large single allocations +- ? **Correct enumeration**: Staging buffer prevents corruption during LINQ-derived expansion +- ? **Amortized performance**: Cost decreases over time as capacity stabilizes +- ? **Safe concurrent access**: `Read()`, `Rematerialize()`, and `ToRangeData()` share a lock; mid-swap observation is impossible +- ? **Expensive reads**: Each read acquires a lock, allocates, and copies +- ? **Higher memory**: Two buffers instead of one +- ?? **Lock contention**: Reader briefly blocks if rematerialization is in progress (bounded to a single `Rematerialize()` call duration) ### Memory Behavior @@ -204,18 +204,18 @@ lock (_lock) The library provides built-in support for layered cache composition via `LayeredWindowCacheBuilder` and `WindowCacheDataSourceAdapter`. ```csharp -// Two-layer cache: L2 (CopyOnRead, large) → L1 (Snapshot, small) +// Two-layer cache: L2 (CopyOnRead, large) > L1 (Snapshot, small) await using var cache = WindowCacheBuilder.Layered(slowDataSource, domain) .AddLayer(new WindowCacheOptions( // L2: deep background cache leftCacheSize: 10.0, rightCacheSize: 10.0, leftThreshold: 0.3, rightThreshold: 0.3, - readMode: UserCacheReadMode.CopyOnRead)) // ← cheap rematerialization + readMode: UserCacheReadMode.CopyOnRead)) // < cheap rematerialization .AddLayer(new WindowCacheOptions( // L1: user-facing cache leftCacheSize: 0.5, rightCacheSize: 0.5, - readMode: UserCacheReadMode.Snapshot)) // ← zero-allocation reads + readMode: UserCacheReadMode.Snapshot)) // < zero-allocation reads .Build(); // User scrolls: @@ -254,18 +254,18 @@ var userCache = new WindowCache( ### Choose **Snapshot** if: -1. ✅ You expect **many reads per rematerialization** (>10:1 ratio) -2. ✅ Cache size is **predictable and modest** (<85KB) -3. ✅ Read latency is **critical** (user-facing UI) -4. ✅ Memory allocation during rematerialization is **acceptable** +1. ? You expect **many reads per rematerialization** (>10:1 ratio) +2. ? Cache size is **predictable and modest** (<85KB) +3. ? Read latency is **critical** (user-facing UI) +4. ? Memory allocation during rematerialization is **acceptable** ### Choose **CopyOnRead** if: -1. ✅ You expect **frequent rematerialization** (random access, non-sequential) -2. ✅ Cache size is **large** (>100KB) -3. ✅ Read latency is **less critical** (background layer) -4. ✅ You want to **amortize allocation cost** over time -5. ✅ You're building a **multi-level cache composition** +1. ? You expect **frequent rematerialization** (random access, non-sequential) +2. ? Cache size is **large** (>100KB) +3. ? Read latency is **less critical** (background layer) +4. ? You want to **amortize allocation cost** over time +5. ? You're building a **multi-level cache composition** ### Default Recommendation @@ -282,7 +282,7 @@ var userCache = new WindowCache( | Operation | Time | Allocation | |---------------|------|---------------| | Read | O(1) | 0 bytes | -| Rematerialize | O(n) | n × sizeof(T) | +| Rematerialize | O(n) | n ? sizeof(T) | | ToRangeData | O(1) | 0 bytes* | *Returns lazy enumerable @@ -291,10 +291,10 @@ var userCache = new WindowCache( | Operation | Time | Allocation | Notes | |----------------------|------|---------------|----------------------------------------| -| Read | O(n) | n × sizeof(T) | Lock acquired + copy | -| Rematerialize (cold) | O(n) | n × sizeof(T) | Enumerate outside lock | +| Read | O(n) | n ? sizeof(T) | Lock acquired + copy | +| Rematerialize (cold) | O(n) | n ? sizeof(T) | Enumerate outside lock | | Rematerialize (warm) | O(n) | 0 bytes** | Enumerate outside lock | -| ToRangeData | O(n) | n × sizeof(T) | Lock acquired + array snapshot copy | +| ToRangeData | O(n) | n ? sizeof(T) | Lock acquired + array snapshot copy | **When capacity is sufficient @@ -325,7 +325,7 @@ Real-world measurements from `RebalanceFlowBenchmarks` demonstrate the allocatio These results validate the design philosophy: CopyOnRead trades per-read allocation cost for dramatically reduced rematerialization overhead. -For complete benchmark details, see [Benchmark Suite README](../benchmarks/SlidingWindowCache.Benchmarks/README.md). +For complete benchmark details, see [Benchmark Suite README](../benchmarks/Intervals.NET.Caching.Benchmarks/README.md). --- @@ -339,7 +339,7 @@ Consider cache expansion during user request: // Current cache: [100, 110] var currentData = cache.ToRangeData(); // CopyOnReadStorage: acquires _lock, copies _activeStorage to a new array, returns immutable snapshot. -// The returned RangeData.Data is decoupled from the live buffers — no lazy reference. +// The returned RangeData.Data is decoupled from the live buffers � no lazy reference. // User requests: [105, 115] var extendedData = await ExtendCacheAsync(currentData, [105, 115]); @@ -354,7 +354,7 @@ cache.Rematerialize(extendedData); > **Why the snapshot copy matters:** Without `.ToArray()`, `ToRangeData()` would return a lazy > `IEnumerable` over the live `_activeStorage` list. That reference is published as an `Intent` > and consumed asynchronously on the rebalance thread. A second `Rematerialize()` call would swap -> the list to `_stagingBuffer` and clear it before the Intent is consumed — silently emptying the +> the list to `_stagingBuffer` and clear it before the Intent is consumed � silently emptying the > enumerable mid-enumeration (or causing `InvalidOperationException`). The snapshot copy eliminates > this race entirely. @@ -364,7 +364,7 @@ cache.Rematerialize(extendedData); 2. **Staging buffer is write-only during rematerialization**: Cleared and filled outside the lock, then swapped under lock 3. **Swap is lock-protected**: `Read()`, `ToRangeData()`, and `Rematerialize()` share `_lock`; all callers always observe a consistent `(_activeStorage, Range)` pair 4. **Buffers never shrink**: Capacity grows monotonically, amortizing allocation cost -5. **`ToRangeData()` snapshots are immutable**: `ToRangeData()` copies `_activeStorage` to a new array under the lock, ensuring the returned `RangeData` is decoupled from buffer reuse — a subsequent `Rematerialize()` cannot corrupt or empty data still referenced by an outstanding enumerable +5. **`ToRangeData()` snapshots are immutable**: `ToRangeData()` copies `_activeStorage` to a new array under the lock, ensuring the returned `RangeData` is decoupled from buffer reuse � a subsequent `Rematerialize()` cannot corrupt or empty data still referenced by an outstanding enumerable ### Memory Growth Example @@ -374,16 +374,16 @@ _activeStorage: capacity=0, count=0 _stagingBuffer: capacity=0, count=0 After Rematerialize([100 items]): -_activeStorage: capacity=128, count=100 ← List grew to 128 +_activeStorage: capacity=128, count=100 < List grew to 128 _stagingBuffer: capacity=0, count=0 After Rematerialize([150 items]): -_activeStorage: capacity=256, count=150 ← Reused capacity=128, grew to 256 -_stagingBuffer: capacity=128, count=100 ← Swapped, now has old capacity +_activeStorage: capacity=256, count=150 < Reused capacity=128, grew to 256 +_stagingBuffer: capacity=128, count=100 < Swapped, now has old capacity After Rematerialize([120 items]): -_activeStorage: capacity=128, count=120 ← Reused capacity=128, no allocation! -_stagingBuffer: capacity=256, count=150 ← Swapped +_activeStorage: capacity=128, count=120 < Reused capacity=128, no allocation! +_stagingBuffer: capacity=256, count=150 < Swapped Steady state reached: Both buffers have sufficient capacity, no more allocations ``` @@ -415,7 +415,7 @@ The staging buffer pattern directly supports key system invariants: - `CopyOnReadStorage` is **conditionally compliant**: `Read()` and `ToRangeData()` acquire `_lock`, which is also held by `Rematerialize()` for the duration of the buffer swap and Range update (a fast, bounded operation). -- Contention is limited to the swap itself — not the full rebalance cycle (fetch + decision + execution). +- Contention is limited to the swap itself � not the full rebalance cycle (fetch + decision + execution). The enumeration into the staging buffer happens **before** the lock is acquired, so the lock hold time is just the cost of two field writes and a property assignment. - `SnapshotReadStorage` remains fully lock-free if strict A.4 compliance is required. diff --git a/src/SlidingWindowCache.WasmValidation/SlidingWindowCache.WasmValidation.csproj b/src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj similarity index 87% rename from src/SlidingWindowCache.WasmValidation/SlidingWindowCache.WasmValidation.csproj rename to src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj index 751b075..8ea3966 100644 --- a/src/SlidingWindowCache.WasmValidation/SlidingWindowCache.WasmValidation.csproj +++ b/src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/SlidingWindowCache.WasmValidation/README.md b/src/Intervals.NET.Caching.WasmValidation/README.md similarity index 61% rename from src/SlidingWindowCache.WasmValidation/README.md rename to src/Intervals.NET.Caching.WasmValidation/README.md index ac22846..c070e2a 100644 --- a/src/SlidingWindowCache.WasmValidation/README.md +++ b/src/Intervals.NET.Caching.WasmValidation/README.md @@ -1,33 +1,33 @@ -# SlidingWindowCache.WasmValidation +# Intervals.NET.Caching.WasmValidation ## Purpose -This project is a **WebAssembly compilation validation target** for the SlidingWindowCache library. It is **NOT** a demo application, test project, or runtime sample. +This project is a **WebAssembly compilation validation target** for the Intervals.NET.Caching library. It is **NOT** a demo application, test project, or runtime sample. ## Goal -The sole purpose of this project is to ensure that the SlidingWindowCache library successfully compiles for the `net8.0-browser` target framework, validating WebAssembly compatibility. +The sole purpose of this project is to ensure that the Intervals.NET.Caching library successfully compiles for the `net8.0-browser` target framework, validating WebAssembly compatibility. ## What This Is NOT -- ❌ **Not a demo** - Does not demonstrate usage patterns or best practices -- ❌ **Not a test project** - Contains no assertions, test framework, or test execution logic -- ❌ **Not a runtime validation** - Code is not intended to be executed in CI/CD or production -- ❌ **Not a sample** - Does not showcase real-world scenarios or advanced features +- ? **Not a demo** - Does not demonstrate usage patterns or best practices +- ? **Not a test project** - Contains no assertions, test framework, or test execution logic +- ? **Not a runtime validation** - Code is not intended to be executed in CI/CD or production +- ? **Not a sample** - Does not showcase real-world scenarios or advanced features ## What This IS -- ✅ **Compile-only validation** - Successful build proves WebAssembly compatibility -- ✅ **CI/CD compatibility check** - Ensures library can target browser environments -- ✅ **Strategy coverage validation** - Validates all internal storage and serialization strategies -- ✅ **Minimal API usage** - Instantiates core types to validate no platform-incompatible APIs are used -- ✅ **Layered cache coverage** - Validates `LayeredWindowCacheBuilder`, `WindowCacheDataSourceAdapter`, and `LayeredWindowCache` compile for WASM +- ? **Compile-only validation** - Successful build proves WebAssembly compatibility +- ? **CI/CD compatibility check** - Ensures library can target browser environments +- ? **Strategy coverage validation** - Validates all internal storage and serialization strategies +- ? **Minimal API usage** - Instantiates core types to validate no platform-incompatible APIs are used +- ? **Layered cache coverage** - Validates `LayeredWindowCacheBuilder`, `WindowCacheDataSourceAdapter`, and `LayeredWindowCache` compile for WASM ## Implementation The project validates all combinations of **strategy-determining configuration options** that affect internal implementation paths: -### Strategy Matrix (2×2 = 4 Configurations) +### Strategy Matrix (2?2 = 4 Configurations) | Config | ReadMode | RebalanceQueueCapacity | Storage Strategy | Serialization Strategy | |--------|------------|------------------------|---------------------|-------------------------| @@ -39,12 +39,12 @@ The project validates all combinations of **strategy-determining configuration o ### Why These Configurations? **ReadMode** determines the storage strategy: -- `Snapshot` → `SnapshotReadStorage` (contiguous array, zero-allocation reads) -- `CopyOnRead` → `CopyOnReadStorage` (growable List, copy-on-read) +- `Snapshot` > `SnapshotReadStorage` (contiguous array, zero-allocation reads) +- `CopyOnRead` > `CopyOnReadStorage` (growable List, copy-on-read) **RebalanceQueueCapacity** determines the serialization strategy: -- `null` → Task-based serialization (unbounded queue, task chaining) -- `>= 1` → Channel-based serialization (System.Threading.Channels with bounded capacity) +- `null` > Task-based serialization (unbounded queue, task chaining) +- `>= 1` > Channel-based serialization (System.Threading.Channels with bounded capacity) Other configuration parameters (leftCacheSize, rightCacheSize, thresholds, debounceDelay) are numeric values that don't affect code path selection, so they don't require separate WASM validation. @@ -72,26 +72,26 @@ All code uses deterministic, synchronous-friendly patterns suitable for compile- Method 5 (`ValidateLayeredCache_TwoLayer_RecommendedConfig`) validates that the three new public layered cache types compile for `net8.0-browser`: -- `LayeredWindowCacheBuilder` — fluent builder wiring layers via the adapter -- `WindowCacheDataSourceAdapter` — bridges `IWindowCache` to `IDataSource` -- `LayeredWindowCache` — wrapper owning all layers; `WaitForIdleAsync` +- `LayeredWindowCacheBuilder` fluent builder wiring layers via the adapter +- `WindowCacheDataSourceAdapter` bridges `IWindowCache` to `IDataSource` +- `LayeredWindowCache` wrapper owning all layers; `WaitForIdleAsync` awaits all layers sequentially (outermost to innermost) Uses the recommended configuration: `CopyOnRead` inner layer (large buffers) + `Snapshot` outer layer (small buffers). A single method is sufficient because the layered cache types introduce no -new strategy axes — they delegate to underlying `WindowCache` instances whose internal strategies -are already covered by methods 1–4. +new strategy axes they delegate to underlying `WindowCache` instances whose internal strategies +are already covered by methods 14. ## Build Validation To validate WebAssembly compatibility: ```bash -dotnet build src/SlidingWindowCache.WasmValidation/SlidingWindowCache.WasmValidation.csproj +dotnet build src/Intervals.NET.Caching.WasmValidation/Intervals.NET.Caching.WasmValidation.csproj ``` A successful build confirms that: -- All SlidingWindowCache public APIs compile for `net8.0-browser` +- All Intervals.NET.Caching public APIs compile for `net8.0-browser` - No platform-specific APIs incompatible with WebAssembly are used - Intervals.NET dependencies are WebAssembly-compatible - **All internal storage strategies** (SnapshotReadStorage, CopyOnReadStorage) are WASM-compatible @@ -110,7 +110,7 @@ Matches the main library dependencies: - Intervals.NET.Data (0.0.1) - Intervals.NET.Domain.Default (0.0.2) - Intervals.NET.Domain.Extensions (0.0.3) -- SlidingWindowCache (project reference) +- Intervals.NET.Caching (project reference) ## Integration with CI/CD diff --git a/src/SlidingWindowCache.WasmValidation/WasmCompilationValidator.cs b/src/Intervals.NET.Caching.WasmValidation/WasmCompilationValidator.cs similarity index 92% rename from src/SlidingWindowCache.WasmValidation/WasmCompilationValidator.cs rename to src/Intervals.NET.Caching.WasmValidation/WasmCompilationValidator.cs index a5c1eae..2bddd2d 100644 --- a/src/SlidingWindowCache.WasmValidation/WasmCompilationValidator.cs +++ b/src/Intervals.NET.Caching.WasmValidation/WasmCompilationValidator.cs @@ -1,12 +1,12 @@ -using Intervals.NET; +using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Dto; -using SlidingWindowCache.Public.Extensions; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Dto; +using Intervals.NET.Caching.Public.Extensions; -namespace SlidingWindowCache.WasmValidation; +namespace Intervals.NET.Caching.WasmValidation; /// /// Minimal IDataSource implementation for WebAssembly compilation validation. @@ -40,7 +40,7 @@ CancellationToken cancellationToken } /// -/// WebAssembly compilation validator for SlidingWindowCache. +/// WebAssembly compilation validator for Intervals.NET.Caching. /// This static class validates that the library can compile for net8.0-browser. /// It is NOT intended to be executed - successful compilation is the validation. /// @@ -69,11 +69,11 @@ CancellationToken cancellationToken /// /// /// -/// — +/// /// strong consistency (always waits for idle) /// /// -/// — +/// /// hybrid consistency (waits on miss/partial hit, returns immediately on full hit) /// /// @@ -250,19 +250,19 @@ public static async Task ValidateConfiguration4_CopyOnReadMode_BoundedQueue() /// Types Validated: /// /// - /// — + /// /// strong consistency extension method; composes GetDataAsync + unconditional WaitForIdleAsync /// /// /// The try { await WaitForIdleAsync } catch (OperationCanceledException) { } pattern - /// inside the extension method — validates that exception handling compiles on WASM + /// inside the extension method validates that exception handling compiles on WASM /// /// /// Why One Configuration Is Sufficient: /// /// The extension method introduces no new strategy axes (storage or serialization). It is a /// thin wrapper over GetDataAsync + WaitForIdleAsync; the four internal strategy combinations - /// are already covered by Configurations 1–4. + /// are already covered by Configurations 14. /// /// public static async Task ValidateStrongConsistencyMode_GetDataAndWaitForIdleAsync() @@ -292,7 +292,7 @@ public static async Task ValidateStrongConsistencyMode_GetDataAndWaitForIdleAsyn _ = result.CacheInteraction; // Cancellation graceful degradation path: pre-cancelled token; WaitForIdleAsync - // throws OperationCanceledException which is caught — result returned gracefully + // throws OperationCanceledException which is caught result returned gracefully using var cts = new CancellationTokenSource(); cts.Cancel(); var degradedResult = await cache.GetDataAndWaitForIdleAsync(range, cts.Token); @@ -309,23 +309,23 @@ public static async Task ValidateStrongConsistencyMode_GetDataAndWaitForIdleAsyn /// Types Validated: /// /// - /// — + /// /// hybrid consistency extension method; composes GetDataAsync + conditional WaitForIdleAsync /// gated on /// /// - /// enum — read from + /// enum read from /// on the returned result /// /// /// The try { await WaitForIdleAsync } catch (OperationCanceledException) { } pattern - /// inside the extension method — validates that exception handling compiles on WASM + /// inside the extension method validates that exception handling compiles on WASM /// /// /// Why One Configuration Is Sufficient: /// /// The extension method introduces no new strategy axes. The four internal strategy - /// combinations are already covered by Configurations 1–4. + /// combinations are already covered by Configurations 14. /// /// public static async Task ValidateHybridConsistencyMode_GetDataAndWaitOnMissAsync() @@ -349,7 +349,7 @@ public static async Task ValidateHybridConsistencyMode_GetDataAndWaitOnMissAsync var range = Intervals.NET.Factories.Range.Closed(0, 10); - // FullMiss path (first request — cold cache): idle wait is triggered + // FullMiss path (first request cold cache): idle wait is triggered var missResult = await cache.GetDataAndWaitOnMissAsync(range, CancellationToken.None); _ = missResult.Data.Length; _ = missResult.CacheInteraction; // FullMiss @@ -360,7 +360,7 @@ public static async Task ValidateHybridConsistencyMode_GetDataAndWaitOnMissAsync _ = hitResult.CacheInteraction; // FullHit // Cancellation graceful degradation path: pre-cancelled token on a miss scenario; - // WaitForIdleAsync throws OperationCanceledException which is caught — result returned gracefully + // WaitForIdleAsync throws OperationCanceledException which is caught result returned gracefully using var cts = new CancellationTokenSource(); cts.Cancel(); var degradedResult = await cache.GetDataAndWaitOnMissAsync(range, cts.Token); @@ -379,15 +379,15 @@ public static async Task ValidateHybridConsistencyMode_GetDataAndWaitOnMissAsync /// Types Validated: /// /// - /// — fluent builder + /// fluent builder /// wiring layers together via /// /// - /// — adapter bridging + /// adapter bridging /// to /// /// - /// — wrapper that delegates + /// wrapper that delegates /// to the outermost layer and /// awaits all layers sequentially on /// @@ -396,7 +396,7 @@ public static async Task ValidateHybridConsistencyMode_GetDataAndWaitOnMissAsync /// /// The layered cache types introduce no new strategy axes: they delegate to underlying /// instances whose internal strategies - /// are already covered by Configurations 1–4. A single method proving all three new + /// are already covered by Configurations 14. A single method proving all three new /// public types compile on WASM is therefore sufficient. /// /// @@ -422,7 +422,7 @@ public static async Task ValidateLayeredCache_TwoLayer_RecommendedConfig() rightThreshold: 0.2 ); - // Build the layered cache — exercises LayeredWindowCacheBuilder, + // Build the layered cache exercises LayeredWindowCacheBuilder, // WindowCacheDataSourceAdapter, and LayeredWindowCache await using var layered = (LayeredWindowCache)WindowCacheBuilder.Layered(new SimpleDataSource(), domain) .AddLayer(innerOptions) diff --git a/src/SlidingWindowCache/Core/Planning/NoRebalanceRangePlanner.cs b/src/Intervals.NET.Caching/Core/Planning/NoRebalanceRangePlanner.cs similarity index 96% rename from src/SlidingWindowCache/Core/Planning/NoRebalanceRangePlanner.cs rename to src/Intervals.NET.Caching/Core/Planning/NoRebalanceRangePlanner.cs index 8f18e20..181c797 100644 --- a/src/SlidingWindowCache/Core/Planning/NoRebalanceRangePlanner.cs +++ b/src/Intervals.NET.Caching/Core/Planning/NoRebalanceRangePlanner.cs @@ -1,10 +1,10 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Rebalance.Decision; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Infrastructure.Extensions; +using Intervals.NET.Caching.Core.Rebalance.Decision; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Infrastructure.Extensions; -namespace SlidingWindowCache.Core.Planning; +namespace Intervals.NET.Caching.Core.Planning; /// /// Plans the no-rebalance range by shrinking the cache range using threshold ratios. diff --git a/src/SlidingWindowCache/Core/Planning/ProportionalRangePlanner.cs b/src/Intervals.NET.Caching/Core/Planning/ProportionalRangePlanner.cs similarity index 97% rename from src/SlidingWindowCache/Core/Planning/ProportionalRangePlanner.cs rename to src/Intervals.NET.Caching/Core/Planning/ProportionalRangePlanner.cs index e0763ec..deeaea5 100644 --- a/src/SlidingWindowCache/Core/Planning/ProportionalRangePlanner.cs +++ b/src/Intervals.NET.Caching/Core/Planning/ProportionalRangePlanner.cs @@ -1,11 +1,11 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Rebalance.Decision; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Infrastructure.Extensions; +using Intervals.NET.Caching.Core.Rebalance.Decision; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Infrastructure.Extensions; -namespace SlidingWindowCache.Core.Planning; +namespace Intervals.NET.Caching.Core.Planning; /// /// Computes the canonical DesiredCacheRange for a given user RequestedRange and cache geometry configuration. diff --git a/src/SlidingWindowCache/Core/Rebalance/Decision/NoRebalanceSatisfactionPolicy.cs b/src/Intervals.NET.Caching/Core/Rebalance/Decision/NoRebalanceSatisfactionPolicy.cs similarity index 95% rename from src/SlidingWindowCache/Core/Rebalance/Decision/NoRebalanceSatisfactionPolicy.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Decision/NoRebalanceSatisfactionPolicy.cs index b561aa8..da14120 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Decision/NoRebalanceSatisfactionPolicy.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Decision/NoRebalanceSatisfactionPolicy.cs @@ -1,7 +1,7 @@ -using Intervals.NET; +using Intervals.NET; using Intervals.NET.Extensions; -namespace SlidingWindowCache.Core.Rebalance.Decision; +namespace Intervals.NET.Caching.Core.Rebalance.Decision; /// /// Evaluates whether rebalancing should occur based on no-rebalance range containment. diff --git a/src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecision.cs b/src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecision.cs similarity index 96% rename from src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecision.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecision.cs index 9547828..2e3601c 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecision.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecision.cs @@ -1,6 +1,6 @@ -using Intervals.NET; +using Intervals.NET; -namespace SlidingWindowCache.Core.Rebalance.Decision; +namespace Intervals.NET.Caching.Core.Rebalance.Decision; /// /// Represents the result of a rebalance decision evaluation. diff --git a/src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs b/src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecisionEngine.cs similarity index 98% rename from src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecisionEngine.cs index b05f48e..1065294 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceDecisionEngine.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceDecisionEngine.cs @@ -1,8 +1,8 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Planning; +using Intervals.NET.Caching.Core.Planning; -namespace SlidingWindowCache.Core.Rebalance.Decision; +namespace Intervals.NET.Caching.Core.Rebalance.Decision; /// /// Evaluates whether rebalance execution is required based on cache geometry policy. diff --git a/src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceReason.cs b/src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceReason.cs similarity index 93% rename from src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceReason.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceReason.cs index 7d3decc..178cf75 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Decision/RebalanceReason.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Decision/RebalanceReason.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Core.Rebalance.Decision; +namespace Intervals.NET.Caching.Core.Rebalance.Decision; /// /// Specifies the reason for a rebalance decision outcome. diff --git a/src/SlidingWindowCache/Core/Rebalance/Execution/CacheDataExtensionService.cs b/src/Intervals.NET.Caching/Core/Rebalance/Execution/CacheDataExtensionService.cs similarity index 97% rename from src/SlidingWindowCache/Core/Rebalance/Execution/CacheDataExtensionService.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Execution/CacheDataExtensionService.cs index 9d086d8..d0d4745 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Execution/CacheDataExtensionService.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Execution/CacheDataExtensionService.cs @@ -1,13 +1,13 @@ -using Intervals.NET; +using Intervals.NET; using Intervals.NET.Data; using Intervals.NET.Data.Extensions; using Intervals.NET.Domain.Abstractions; using Intervals.NET.Extensions; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Core.Rebalance.Execution; +namespace Intervals.NET.Caching.Core.Rebalance.Execution; /// /// Fetches missing data from the data source to extend the cache. diff --git a/src/SlidingWindowCache/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs b/src/Intervals.NET.Caching/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs similarity index 98% rename from src/SlidingWindowCache/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs index 87a3aba..6c86511 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Execution/ChannelBasedRebalanceExecutionController.cs @@ -1,12 +1,12 @@ using System.Threading.Channels; using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Infrastructure.Concurrency; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Infrastructure.Concurrency; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Core.Rebalance.Execution; +namespace Intervals.NET.Caching.Core.Rebalance.Execution; /// /// Channel-based execution actor responsible for sequential execution of rebalance operations with bounded capacity and backpressure support. diff --git a/src/SlidingWindowCache/Core/Rebalance/Execution/ExecutionRequest.cs b/src/Intervals.NET.Caching/Core/Rebalance/Execution/ExecutionRequest.cs similarity index 98% rename from src/SlidingWindowCache/Core/Rebalance/Execution/ExecutionRequest.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Execution/ExecutionRequest.cs index 975ad3f..9c0faf4 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Execution/ExecutionRequest.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Execution/ExecutionRequest.cs @@ -1,8 +1,8 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Rebalance.Intent; +using Intervals.NET.Caching.Core.Rebalance.Intent; -namespace SlidingWindowCache.Core.Rebalance.Execution; +namespace Intervals.NET.Caching.Core.Rebalance.Execution; /// /// Execution request message sent from IntentController to IRebalanceExecutionController implementations. diff --git a/src/SlidingWindowCache/Core/Rebalance/Execution/IRebalanceExecutionController.cs b/src/Intervals.NET.Caching/Core/Rebalance/Execution/IRebalanceExecutionController.cs similarity index 97% rename from src/SlidingWindowCache/Core/Rebalance/Execution/IRebalanceExecutionController.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Execution/IRebalanceExecutionController.cs index 7aa780b..f58999c 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Execution/IRebalanceExecutionController.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Execution/IRebalanceExecutionController.cs @@ -1,9 +1,9 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Public.Cache; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Public.Cache; -namespace SlidingWindowCache.Core.Rebalance.Execution; +namespace Intervals.NET.Caching.Core.Rebalance.Execution; /// /// Abstraction for rebalance execution serialization strategies. diff --git a/src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutionControllerBase.cs b/src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutionControllerBase.cs similarity index 97% rename from src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutionControllerBase.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutionControllerBase.cs index 66b6c5f..ccf0ffe 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutionControllerBase.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutionControllerBase.cs @@ -1,11 +1,11 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Infrastructure.Concurrency; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Infrastructure.Concurrency; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Core.Rebalance.Execution; +namespace Intervals.NET.Caching.Core.Rebalance.Execution; /// /// Abstract base class providing the shared execution pipeline for rebalance execution controllers. diff --git a/src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs b/src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs similarity index 91% rename from src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs index 5845325..2095ebf 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Execution/RebalanceExecutor.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Execution/RebalanceExecutor.cs @@ -1,10 +1,10 @@ -using Intervals.NET; +using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Core.Rebalance.Execution; +namespace Intervals.NET.Caching.Core.Rebalance.Execution; /// /// Executes rebalance operations by fetching missing data, merging with existing cache, @@ -19,7 +19,7 @@ namespace SlidingWindowCache.Core.Rebalance.Execution; /// Characteristics: Asynchronous, cancellable, heavyweight /// Responsibility: Cache normalization (expand, trim, recompute NoRebalanceRange) /// Execution Serialization: Provided by the active IRebalanceExecutionController actor, which ensures -/// only one rebalance execution runs at a time — either via task chaining (TaskBasedRebalanceExecutionController, default) +/// only one rebalance execution runs at a time either via task chaining (TaskBasedRebalanceExecutionController, default) /// or via bounded channel (ChannelBasedRebalanceExecutionController). /// CancellationToken provides early exit signaling. WebAssembly-compatible, async, and lightweight. /// @@ -71,7 +71,7 @@ ICacheDiagnostics cacheDiagnostics /// /// Serialization: The active IRebalanceExecutionController actor guarantees single-threaded /// execution (via task chaining or channel-based sequential processing depending on configuration). - /// No semaphore needed — the actor ensures only one execution runs at a time. + /// No semaphore needed the actor ensures only one execution runs at a time. /// Cancellation allows fast exit from superseded operations. /// public async Task ExecuteAsync( @@ -103,7 +103,7 @@ public async Task ExecuteAsync( // Ensures we don't apply obsolete rebalance results cancellationToken.ThrowIfCancellationRequested(); - // Phase 3: Apply cache state mutations (single writer — all fields updated atomically) + // Phase 3: Apply cache state mutations (single writer all fields updated atomically) _state.UpdateCacheState(normalizedData, desiredNoRebalanceRange); _cacheDiagnostics.RebalanceExecutionCompleted(); diff --git a/src/SlidingWindowCache/Core/Rebalance/Execution/TaskBasedRebalanceExecutionController.cs b/src/Intervals.NET.Caching/Core/Rebalance/Execution/TaskBasedRebalanceExecutionController.cs similarity index 98% rename from src/SlidingWindowCache/Core/Rebalance/Execution/TaskBasedRebalanceExecutionController.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Execution/TaskBasedRebalanceExecutionController.cs index 207cb99..6d32466 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Execution/TaskBasedRebalanceExecutionController.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Execution/TaskBasedRebalanceExecutionController.cs @@ -1,11 +1,11 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Infrastructure.Concurrency; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Infrastructure.Concurrency; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Core.Rebalance.Execution; +namespace Intervals.NET.Caching.Core.Rebalance.Execution; /// /// Task-based execution actor responsible for sequential execution of rebalance operations using task chaining for unbounded serialization. diff --git a/src/SlidingWindowCache/Core/Rebalance/Intent/Intent.cs b/src/Intervals.NET.Caching/Core/Rebalance/Intent/Intent.cs similarity index 96% rename from src/SlidingWindowCache/Core/Rebalance/Intent/Intent.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Intent/Intent.cs index f7b4a48..1171aee 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Intent/Intent.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Intent/Intent.cs @@ -2,7 +2,7 @@ using Intervals.NET.Data; using Intervals.NET.Domain.Abstractions; -namespace SlidingWindowCache.Core.Rebalance.Intent; +namespace Intervals.NET.Caching.Core.Rebalance.Intent; /// /// Represents the intent to rebalance the cache based on a requested range and the currently assembled range data. diff --git a/src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs b/src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs similarity index 98% rename from src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs rename to src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs index 9ccb3c9..835c25c 100644 --- a/src/SlidingWindowCache/Core/Rebalance/Intent/IntentController.cs +++ b/src/Intervals.NET.Caching/Core/Rebalance/Intent/IntentController.cs @@ -1,11 +1,11 @@ -using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Rebalance.Decision; -using SlidingWindowCache.Core.Rebalance.Execution; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Infrastructure.Concurrency; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Domain.Abstractions; +using Intervals.NET.Caching.Core.Rebalance.Decision; +using Intervals.NET.Caching.Core.Rebalance.Execution; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Infrastructure.Concurrency; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Core.Rebalance.Intent; +namespace Intervals.NET.Caching.Core.Rebalance.Intent; /// /// Manages the lifecycle of rebalance intents using a single-threaded loop with burst resistance. diff --git a/src/SlidingWindowCache/Core/State/CacheState.cs b/src/Intervals.NET.Caching/Core/State/CacheState.cs similarity index 97% rename from src/SlidingWindowCache/Core/State/CacheState.cs rename to src/Intervals.NET.Caching/Core/State/CacheState.cs index 58f351b..819335c 100644 --- a/src/SlidingWindowCache/Core/State/CacheState.cs +++ b/src/Intervals.NET.Caching/Core/State/CacheState.cs @@ -1,8 +1,8 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Infrastructure.Storage; +using Intervals.NET.Caching.Infrastructure.Storage; -namespace SlidingWindowCache.Core.State; +namespace Intervals.NET.Caching.Core.State; /// /// Encapsulates the mutable state of a window cache. diff --git a/src/SlidingWindowCache/Core/State/RuntimeCacheOptions.cs b/src/Intervals.NET.Caching/Core/State/RuntimeCacheOptions.cs similarity index 96% rename from src/SlidingWindowCache/Core/State/RuntimeCacheOptions.cs rename to src/Intervals.NET.Caching/Core/State/RuntimeCacheOptions.cs index bda5d52..fcc9eef 100644 --- a/src/SlidingWindowCache/Core/State/RuntimeCacheOptions.cs +++ b/src/Intervals.NET.Caching/Core/State/RuntimeCacheOptions.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching.Public.Configuration; -namespace SlidingWindowCache.Core.State; +namespace Intervals.NET.Caching.Core.State; /// /// An immutable snapshot of the runtime-updatable cache configuration values. @@ -22,7 +22,7 @@ namespace SlidingWindowCache.Core.State; /// Validation: /// /// Applies the same validation rules as -/// : +/// : /// cache sizes ≥ 0, thresholds in [0, 1], threshold sum ≤ 1.0. /// /// Threading: diff --git a/src/SlidingWindowCache/Core/State/RuntimeCacheOptionsHolder.cs b/src/Intervals.NET.Caching/Core/State/RuntimeCacheOptionsHolder.cs similarity index 98% rename from src/SlidingWindowCache/Core/State/RuntimeCacheOptionsHolder.cs rename to src/Intervals.NET.Caching/Core/State/RuntimeCacheOptionsHolder.cs index 92e266b..87a5cff 100644 --- a/src/SlidingWindowCache/Core/State/RuntimeCacheOptionsHolder.cs +++ b/src/Intervals.NET.Caching/Core/State/RuntimeCacheOptionsHolder.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Core.State; +namespace Intervals.NET.Caching.Core.State; /// /// Thread-safe holder for the current snapshot. diff --git a/src/SlidingWindowCache/Core/State/RuntimeOptionsValidator.cs b/src/Intervals.NET.Caching/Core/State/RuntimeOptionsValidator.cs similarity index 91% rename from src/SlidingWindowCache/Core/State/RuntimeOptionsValidator.cs rename to src/Intervals.NET.Caching/Core/State/RuntimeOptionsValidator.cs index b2d33c4..2753392 100644 --- a/src/SlidingWindowCache/Core/State/RuntimeOptionsValidator.cs +++ b/src/Intervals.NET.Caching/Core/State/RuntimeOptionsValidator.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Core.State; +namespace Intervals.NET.Caching.Core.State; /// /// Provides shared validation logic for runtime-updatable cache option values. @@ -8,7 +8,7 @@ namespace SlidingWindowCache.Core.State; /// /// Centralizes the validation rules that are common to both /// and -/// , +/// , /// eliminating duplication and ensuring both classes enforce identical constraints. /// /// Validated Rules: @@ -22,10 +22,10 @@ namespace SlidingWindowCache.Core.State; /// Not Validated Here: /// /// Creation-time-only options (rebalanceQueueCapacity) are validated directly -/// in +/// in /// because they do not exist on . /// DebounceDelay is validated on and -/// (must be ≥ 0); +/// (must be ≥ 0); /// this helper centralizes only cache size and threshold validation. /// /// @@ -34,7 +34,7 @@ internal static class RuntimeOptionsValidator /// /// Validates cache size and threshold values that are shared between /// and - /// . + /// . /// /// Must be ≥ 0. /// Must be ≥ 0. diff --git a/src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs b/src/Intervals.NET.Caching/Core/UserPath/UserRequestHandler.cs similarity index 91% rename from src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs rename to src/Intervals.NET.Caching/Core/UserPath/UserRequestHandler.cs index fbcee10..c34063e 100644 --- a/src/SlidingWindowCache/Core/UserPath/UserRequestHandler.cs +++ b/src/Intervals.NET.Caching/Core/UserPath/UserRequestHandler.cs @@ -1,16 +1,16 @@ -using Intervals.NET; +using Intervals.NET; using Intervals.NET.Data; using Intervals.NET.Data.Extensions; using Intervals.NET.Domain.Abstractions; using Intervals.NET.Extensions; -using SlidingWindowCache.Core.Rebalance.Execution; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Core.Rebalance.Execution; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Core.UserPath; +namespace Intervals.NET.Caching.Core.UserPath; /// /// Handles user requests synchronously, serving data from cache or data source. @@ -38,11 +38,11 @@ namespace SlidingWindowCache.Core.UserPath; /// /// Explicit Non-Responsibilities: /// -/// ❌ NEVER checks NoRebalanceRange (belongs to DecisionEngine) -/// ❌ NEVER computes DesiredCacheRange (belongs to GeometryPolicy) -/// ❌ NEVER decides whether to rebalance (belongs to DecisionEngine) -/// ❌ No cache normalization -/// ❌ No trimming or shrinking +/// ? NEVER checks NoRebalanceRange (belongs to DecisionEngine) +/// ? NEVER computes DesiredCacheRange (belongs to GeometryPolicy) +/// ? NEVER decides whether to rebalance (belongs to DecisionEngine) +/// ? No cache normalization +/// ? No trimming or shrinking /// /// internal sealed class UserRequestHandler @@ -106,11 +106,11 @@ ICacheDiagnostics cacheDiagnostics /// User Path NEVER writes to cache state. All cache mutations are performed exclusively /// by Rebalance Execution Path (single-writer architecture). The User Path: /// - /// ✅ May READ from cache - /// ✅ May READ from IDataSource - /// ❌ NEVER writes to Cache (no Rematerialize calls) - /// ❌ NEVER writes to IsInitialized - /// ❌ NEVER writes to NoRebalanceRange + /// ? May READ from cache + /// ? May READ from IDataSource + /// ? NEVER writes to Cache (no Rematerialize calls) + /// ? NEVER writes to IsInitialized + /// ? NEVER writes to NoRebalanceRange /// /// /// Boundary Handling: @@ -201,7 +201,7 @@ public async ValueTask> HandleRequestAsync( } // Publish intent only when there was a physical data hit (assembledData is not null). - // Full vacuum (out-of-physical-bounds) requests produce no intent — there is no + // Full vacuum (out-of-physical-bounds) requests produce no intent there is no // meaningful cache shift to signal to the rebalance pipeline (see Invariant C.8e). if (assembledData is not null) { diff --git a/src/SlidingWindowCache/Infrastructure/Collections/ReadOnlyMemoryEnumerable.cs b/src/Intervals.NET.Caching/Infrastructure/Collections/ReadOnlyMemoryEnumerable.cs similarity index 97% rename from src/SlidingWindowCache/Infrastructure/Collections/ReadOnlyMemoryEnumerable.cs rename to src/Intervals.NET.Caching/Infrastructure/Collections/ReadOnlyMemoryEnumerable.cs index 2f3ddce..6fcb994 100644 --- a/src/SlidingWindowCache/Infrastructure/Collections/ReadOnlyMemoryEnumerable.cs +++ b/src/Intervals.NET.Caching/Infrastructure/Collections/ReadOnlyMemoryEnumerable.cs @@ -1,6 +1,6 @@ using System.Collections; -namespace SlidingWindowCache.Infrastructure.Collections; +namespace Intervals.NET.Caching.Infrastructure.Collections; /// /// A lightweight wrapper over a diff --git a/src/SlidingWindowCache/Infrastructure/Concurrency/AsyncActivityCounter.cs b/src/Intervals.NET.Caching/Infrastructure/Concurrency/AsyncActivityCounter.cs similarity index 93% rename from src/SlidingWindowCache/Infrastructure/Concurrency/AsyncActivityCounter.cs rename to src/Intervals.NET.Caching/Infrastructure/Concurrency/AsyncActivityCounter.cs index a1905e6..3224af8 100644 --- a/src/SlidingWindowCache/Infrastructure/Concurrency/AsyncActivityCounter.cs +++ b/src/Intervals.NET.Caching/Infrastructure/Concurrency/AsyncActivityCounter.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Infrastructure.Concurrency; +namespace Intervals.NET.Caching.Infrastructure.Concurrency; /// /// Lock-free, thread-safe activity counter that provides awaitable idle state notification. @@ -34,16 +34,16 @@ /// /// Idle State Semantics - STATE-BASED, NOT EVENT-BASED: /// -/// Counter starts at 0 (idle). When counter transitions from 0→1, a new TCS is created. -/// When counter transitions from N→0, the TCS is signaled. Multiple waiters can await the same TCS. +/// Counter starts at 0 (idle). When counter transitions from 0>1, a new TCS is created. +/// When counter transitions from N>0, the TCS is signaled. Multiple waiters can await the same TCS. /// /// /// CRITICAL: This is a state-based completion primitive, NOT an event-based signaling primitive. /// TaskCompletionSource is the correct primitive because: /// -/// ✅ State-based: Task.IsCompleted persists, all future awaiters complete immediately -/// ✅ Multiple awaiters: All threads awaiting the same TCS complete when signaled -/// ✅ No lost signals: Idle state is preserved until next busy period +/// ? State-based: Task.IsCompleted persists, all future awaiters complete immediately +/// ? Multiple awaiters: All threads awaiting the same TCS complete when signaled +/// ? No lost signals: Idle state is preserved until next busy period /// /// /// @@ -54,8 +54,8 @@ /// /// TCS lifecycle uses explicit memory barriers via (publish) and (observe): /// -/// Increment (0→1): Creates TCS, publishes via Volatile.Write (release fence) -/// Decrement (N→0): Reads TCS via Volatile.Read (acquire fence), signals idle +/// Increment (0>1): Creates TCS, publishes via Volatile.Write (release fence) +/// Decrement (N>0): Reads TCS via Volatile.Read (acquire fence), signals idle /// WaitForIdleAsync: Snapshots TCS via Volatile.Read (acquire fence) /// /// This ensures proper visibility: readers always observe fully-constructed TCS instances. @@ -75,7 +75,7 @@ internal sealed class AsyncActivityCounter // Current TaskCompletionSource - signaled when counter reaches 0 // Access via Volatile.Read/Write for proper memory barriers - // Published via Volatile.Write on 0→1 transition, observed via Volatile.Read on N→0 transition and WaitForIdleAsync + // Published via Volatile.Write on 0>1 transition, observed via Volatile.Read on N>0 transition and WaitForIdleAsync private TaskCompletionSource _idleTcs = new(TaskCreationOptions.RunContinuationsAsynchronously); /// @@ -110,7 +110,7 @@ public AsyncActivityCounter() /// Volatile.Write provides release fence: all prior writes (TCS construction) are visible to readers. /// This ensures readers via Volatile.Read observe fully-constructed TCS instances. /// - /// Concurrent 0→1 Transitions: + /// Concurrent 0>1 Transitions: /// /// If multiple threads call IncrementActivity concurrently from idle state, Interlocked.Increment /// guarantees only ONE thread observes newCount == 1. That thread creates the TCS for this busy period. diff --git a/src/SlidingWindowCache/Infrastructure/Extensions/IntervalsNetDomainExtensions.cs b/src/Intervals.NET.Caching/Infrastructure/Extensions/IntervalsNetDomainExtensions.cs similarity index 99% rename from src/SlidingWindowCache/Infrastructure/Extensions/IntervalsNetDomainExtensions.cs rename to src/Intervals.NET.Caching/Infrastructure/Extensions/IntervalsNetDomainExtensions.cs index 9e90ad2..dc3432a 100644 --- a/src/SlidingWindowCache/Infrastructure/Extensions/IntervalsNetDomainExtensions.cs +++ b/src/Intervals.NET.Caching/Infrastructure/Extensions/IntervalsNetDomainExtensions.cs @@ -1,7 +1,7 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -namespace SlidingWindowCache.Infrastructure.Extensions; +namespace Intervals.NET.Caching.Infrastructure.Extensions; /// /// Provides domain-agnostic extension methods that work with any IRangeDomain type. diff --git a/src/SlidingWindowCache/Infrastructure/Storage/CopyOnReadStorage.cs b/src/Intervals.NET.Caching/Infrastructure/Storage/CopyOnReadStorage.cs similarity index 99% rename from src/SlidingWindowCache/Infrastructure/Storage/CopyOnReadStorage.cs rename to src/Intervals.NET.Caching/Infrastructure/Storage/CopyOnReadStorage.cs index 2184b76..994b3d3 100644 --- a/src/SlidingWindowCache/Infrastructure/Storage/CopyOnReadStorage.cs +++ b/src/Intervals.NET.Caching/Infrastructure/Storage/CopyOnReadStorage.cs @@ -3,9 +3,9 @@ using Intervals.NET.Data.Extensions; using Intervals.NET.Domain.Abstractions; using Intervals.NET.Extensions; -using SlidingWindowCache.Infrastructure.Extensions; +using Intervals.NET.Caching.Infrastructure.Extensions; -namespace SlidingWindowCache.Infrastructure.Storage; +namespace Intervals.NET.Caching.Infrastructure.Storage; /// /// CopyOnRead strategy that stores data using a dual-buffer (staging buffer) pattern. diff --git a/src/SlidingWindowCache/Infrastructure/Storage/ICacheStorage.cs b/src/Intervals.NET.Caching/Infrastructure/Storage/ICacheStorage.cs similarity index 96% rename from src/SlidingWindowCache/Infrastructure/Storage/ICacheStorage.cs rename to src/Intervals.NET.Caching/Infrastructure/Storage/ICacheStorage.cs index 7cbc5c2..5112986 100644 --- a/src/SlidingWindowCache/Infrastructure/Storage/ICacheStorage.cs +++ b/src/Intervals.NET.Caching/Infrastructure/Storage/ICacheStorage.cs @@ -1,8 +1,8 @@ -using Intervals.NET; +using Intervals.NET; using Intervals.NET.Data; using Intervals.NET.Domain.Abstractions; -namespace SlidingWindowCache.Infrastructure.Storage; +namespace Intervals.NET.Caching.Infrastructure.Storage; /// /// Internal strategy interface for handling user cache read operations. diff --git a/src/SlidingWindowCache/Infrastructure/Storage/SnapshotReadStorage.cs b/src/Intervals.NET.Caching/Infrastructure/Storage/SnapshotReadStorage.cs similarity index 95% rename from src/SlidingWindowCache/Infrastructure/Storage/SnapshotReadStorage.cs rename to src/Intervals.NET.Caching/Infrastructure/Storage/SnapshotReadStorage.cs index c315c6f..eb73c63 100644 --- a/src/SlidingWindowCache/Infrastructure/Storage/SnapshotReadStorage.cs +++ b/src/Intervals.NET.Caching/Infrastructure/Storage/SnapshotReadStorage.cs @@ -1,10 +1,10 @@ -using Intervals.NET; +using Intervals.NET; using Intervals.NET.Data; using Intervals.NET.Data.Extensions; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Infrastructure.Extensions; +using Intervals.NET.Caching.Infrastructure.Extensions; -namespace SlidingWindowCache.Infrastructure.Storage; +namespace Intervals.NET.Caching.Infrastructure.Storage; /// /// Snapshot read strategy that stores data in a contiguous array for zero-allocation reads. diff --git a/src/SlidingWindowCache/SlidingWindowCache.csproj b/src/Intervals.NET.Caching/Intervals.NET.Caching.csproj similarity index 82% rename from src/SlidingWindowCache/SlidingWindowCache.csproj rename to src/Intervals.NET.Caching/Intervals.NET.Caching.csproj index 45bf19b..4913416 100644 --- a/src/SlidingWindowCache/SlidingWindowCache.csproj +++ b/src/Intervals.NET.Caching/Intervals.NET.Caching.csproj @@ -6,14 +6,14 @@ enable - SlidingWindowCache + Intervals.NET.Caching 0.0.1 blaze6950 - SlidingWindowCache + Intervals.NET.Caching A read-only, range-based, sequential-optimized cache with background rebalancing and cancellation-aware prefetching. Designed for scenarios with predictable sequential data access patterns like time-series data, paginated datasets, and streaming content. MIT - https://github.com/blaze6950/SlidingWindowCache - https://github.com/blaze6950/SlidingWindowCache + https://github.com/blaze6950/Intervals.NET.Caching + https://github.com/blaze6950/Intervals.NET.Caching git cache;sliding-window;range-based;async;prefetching;time-series;sequential-access;intervals;performance README.md @@ -26,14 +26,14 @@ - + - + diff --git a/src/SlidingWindowCache/Public/Cache/LayeredWindowCache.cs b/src/Intervals.NET.Caching/Public/Cache/LayeredWindowCache.cs similarity index 98% rename from src/SlidingWindowCache/Public/Cache/LayeredWindowCache.cs rename to src/Intervals.NET.Caching/Public/Cache/LayeredWindowCache.cs index 6321658..50360ba 100644 --- a/src/SlidingWindowCache/Public/Cache/LayeredWindowCache.cs +++ b/src/Intervals.NET.Caching/Public/Cache/LayeredWindowCache.cs @@ -1,9 +1,9 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Public.Cache; +namespace Intervals.NET.Caching.Public.Cache; /// /// A thin wrapper around a stack of instances diff --git a/src/SlidingWindowCache/Public/Cache/LayeredWindowCacheBuilder.cs b/src/Intervals.NET.Caching/Public/Cache/LayeredWindowCacheBuilder.cs similarity index 98% rename from src/SlidingWindowCache/Public/Cache/LayeredWindowCacheBuilder.cs rename to src/Intervals.NET.Caching/Public/Cache/LayeredWindowCacheBuilder.cs index 10abbb0..fefbbfc 100644 --- a/src/SlidingWindowCache/Public/Cache/LayeredWindowCacheBuilder.cs +++ b/src/Intervals.NET.Caching/Public/Cache/LayeredWindowCacheBuilder.cs @@ -1,8 +1,8 @@ using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Public.Cache; +namespace Intervals.NET.Caching.Public.Cache; /// /// Fluent builder for constructing a multi-layer (L1/L2/L3/...) cache stack, where each diff --git a/src/SlidingWindowCache/Public/Cache/WindowCache.cs b/src/Intervals.NET.Caching/Public/Cache/WindowCache.cs similarity index 94% rename from src/SlidingWindowCache/Public/Cache/WindowCache.cs rename to src/Intervals.NET.Caching/Public/Cache/WindowCache.cs index 3941a83..c294b54 100644 --- a/src/SlidingWindowCache/Public/Cache/WindowCache.cs +++ b/src/Intervals.NET.Caching/Public/Cache/WindowCache.cs @@ -1,18 +1,18 @@ -using Intervals.NET; +using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Core.Planning; -using SlidingWindowCache.Core.Rebalance.Decision; -using SlidingWindowCache.Core.Rebalance.Execution; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Core.UserPath; -using SlidingWindowCache.Infrastructure.Concurrency; -using SlidingWindowCache.Infrastructure.Storage; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Dto; -using SlidingWindowCache.Public.Instrumentation; - -namespace SlidingWindowCache.Public.Cache; +using Intervals.NET.Caching.Core.Planning; +using Intervals.NET.Caching.Core.Rebalance.Decision; +using Intervals.NET.Caching.Core.Rebalance.Execution; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Core.UserPath; +using Intervals.NET.Caching.Infrastructure.Concurrency; +using Intervals.NET.Caching.Infrastructure.Storage; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Dto; +using Intervals.NET.Caching.Public.Instrumentation; + +namespace Intervals.NET.Caching.Public.Cache; /// /// @@ -38,7 +38,7 @@ public sealed class WindowCache // Internal actors private readonly UserRequestHandler _userRequestHandler; - // Shared runtime options holder — updated via UpdateRuntimeOptions, read by planners and execution controllers + // Shared runtime options holder updated via UpdateRuntimeOptions, read by planners and execution controllers private readonly RuntimeCacheOptionsHolder _runtimeOptionsHolder; // Activity counter for tracking active intents and executions @@ -277,7 +277,7 @@ public void UpdateRuntimeOptions(Action configure) "Cannot update runtime options on a disposed cache."); } - // ApplyTo reads the current snapshot, merges deltas, and validates — + // ApplyTo reads the current snapshot, merges deltas, and validates // throws if validation fails (holder not updated in that case). var builder = new RuntimeOptionsUpdateBuilder(); configure(builder); @@ -334,7 +334,7 @@ public RuntimeOptionsSnapshot CurrentRuntimeOptions /// /// When multiple threads call DisposeAsync concurrently: /// - /// Winner thread (first to transition 0→1): Creates TCS, performs disposal, signals completion + /// Winner thread (first to transition 0>1): Creates TCS, performs disposal, signals completion /// Loser threads (see state=1): Await TCS.Task to wait asynchronously without CPU burn /// All threads observe the same disposal outcome (success or exception propagation) /// @@ -344,7 +344,7 @@ public RuntimeOptionsSnapshot CurrentRuntimeOptions /// Architectural Context: /// /// WindowCache acts as the Composition Root and owns all internal actors. Disposal follows - /// the ownership hierarchy: WindowCache → UserRequestHandler → IntentController → RebalanceExecutionController. + /// the ownership hierarchy: WindowCache > UserRequestHandler > IntentController > RebalanceExecutionController. /// Each actor disposes its owned resources in reverse order of initialization. /// /// Exception Handling: diff --git a/src/SlidingWindowCache/Public/Cache/WindowCacheBuilder.cs b/src/Intervals.NET.Caching/Public/Cache/WindowCacheBuilder.cs similarity index 98% rename from src/SlidingWindowCache/Public/Cache/WindowCacheBuilder.cs rename to src/Intervals.NET.Caching/Public/Cache/WindowCacheBuilder.cs index 920ff9a..de6bac7 100644 --- a/src/SlidingWindowCache/Public/Cache/WindowCacheBuilder.cs +++ b/src/Intervals.NET.Caching/Public/Cache/WindowCacheBuilder.cs @@ -1,8 +1,8 @@ using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Public.Cache; +namespace Intervals.NET.Caching.Public.Cache; /// /// Non-generic entry point for creating cache instances via fluent builders. diff --git a/src/SlidingWindowCache/Public/Cache/WindowCacheDataSourceAdapter.cs b/src/Intervals.NET.Caching/Public/Cache/WindowCacheDataSourceAdapter.cs similarity index 98% rename from src/SlidingWindowCache/Public/Cache/WindowCacheDataSourceAdapter.cs rename to src/Intervals.NET.Caching/Public/Cache/WindowCacheDataSourceAdapter.cs index 0d19e33..3d3b350 100644 --- a/src/SlidingWindowCache/Public/Cache/WindowCacheDataSourceAdapter.cs +++ b/src/Intervals.NET.Caching/Public/Cache/WindowCacheDataSourceAdapter.cs @@ -1,9 +1,9 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Infrastructure.Collections; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Infrastructure.Collections; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Public.Cache; +namespace Intervals.NET.Caching.Public.Cache; /// /// Adapts an instance to the diff --git a/src/SlidingWindowCache/Public/Configuration/RuntimeOptionsSnapshot.cs b/src/Intervals.NET.Caching/Public/Configuration/RuntimeOptionsSnapshot.cs similarity index 98% rename from src/SlidingWindowCache/Public/Configuration/RuntimeOptionsSnapshot.cs rename to src/Intervals.NET.Caching/Public/Configuration/RuntimeOptionsSnapshot.cs index 87eead8..9dc8bb7 100644 --- a/src/SlidingWindowCache/Public/Configuration/RuntimeOptionsSnapshot.cs +++ b/src/Intervals.NET.Caching/Public/Configuration/RuntimeOptionsSnapshot.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Public.Configuration; +namespace Intervals.NET.Caching.Public.Configuration; /// /// A read-only snapshot of the current runtime-updatable cache option values. diff --git a/src/SlidingWindowCache/Public/Configuration/RuntimeOptionsUpdateBuilder.cs b/src/Intervals.NET.Caching/Public/Configuration/RuntimeOptionsUpdateBuilder.cs similarity index 99% rename from src/SlidingWindowCache/Public/Configuration/RuntimeOptionsUpdateBuilder.cs rename to src/Intervals.NET.Caching/Public/Configuration/RuntimeOptionsUpdateBuilder.cs index 7091691..84aa7a4 100644 --- a/src/SlidingWindowCache/Public/Configuration/RuntimeOptionsUpdateBuilder.cs +++ b/src/Intervals.NET.Caching/Public/Configuration/RuntimeOptionsUpdateBuilder.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Public.Configuration; +namespace Intervals.NET.Caching.Public.Configuration; /// /// Fluent builder for specifying runtime option updates on a live instance. diff --git a/src/SlidingWindowCache/Public/Configuration/UserCacheReadMode.cs b/src/Intervals.NET.Caching/Public/Configuration/UserCacheReadMode.cs similarity index 95% rename from src/SlidingWindowCache/Public/Configuration/UserCacheReadMode.cs rename to src/Intervals.NET.Caching/Public/Configuration/UserCacheReadMode.cs index 020eea0..579c1bd 100644 --- a/src/SlidingWindowCache/Public/Configuration/UserCacheReadMode.cs +++ b/src/Intervals.NET.Caching/Public/Configuration/UserCacheReadMode.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Public.Configuration; +namespace Intervals.NET.Caching.Public.Configuration; /// /// Defines how materialized cache data is exposed to users. @@ -24,7 +24,7 @@ public enum UserCacheReadMode /// Disadvantages: /// /// Rebalance always requires allocating a new array (even if size is unchanged) - /// Large arrays may end up on the Large Object Heap (LOH) when size ≥ 85,000 bytes + /// Large arrays may end up on the Large Object Heap (LOH) when size ? 85,000 bytes /// Higher memory pressure during rebalancing /// /// diff --git a/src/SlidingWindowCache/Public/Configuration/WindowCacheOptions.cs b/src/Intervals.NET.Caching/Public/Configuration/WindowCacheOptions.cs similarity index 92% rename from src/SlidingWindowCache/Public/Configuration/WindowCacheOptions.cs rename to src/Intervals.NET.Caching/Public/Configuration/WindowCacheOptions.cs index 395ae93..b6393be 100644 --- a/src/SlidingWindowCache/Public/Configuration/WindowCacheOptions.cs +++ b/src/Intervals.NET.Caching/Public/Configuration/WindowCacheOptions.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Core.State; +using Intervals.NET.Caching.Core.State; -namespace SlidingWindowCache.Public.Configuration; +namespace Intervals.NET.Caching.Public.Configuration; /// /// Options for configuring the behavior of the sliding window cache. @@ -11,12 +11,12 @@ namespace SlidingWindowCache.Public.Configuration; /// is a sealed class with get-only properties. All values /// are validated at construction time and cannot be changed on this object afterwards. /// Runtime-updatable options (cache sizes, thresholds, debounce delay) may be changed on a live -/// cache instance via . +/// cache instance via . /// /// Creation-time vs Runtime options: /// -/// Creation-time only, : determine which concrete classes are instantiated and cannot change after construction. -/// Runtime-updatable, , , , : configure sliding window geometry and execution timing; may be updated on a live cache instance. +/// Creation-time only , : determine which concrete classes are instantiated and cannot change after construction. +/// Runtime-updatable , , , , : configure sliding window geometry and execution timing; may be updated on a live cache instance. /// /// public sealed class WindowCacheOptions : IEquatable diff --git a/src/SlidingWindowCache/Public/Configuration/WindowCacheOptionsBuilder.cs b/src/Intervals.NET.Caching/Public/Configuration/WindowCacheOptionsBuilder.cs similarity index 99% rename from src/SlidingWindowCache/Public/Configuration/WindowCacheOptionsBuilder.cs rename to src/Intervals.NET.Caching/Public/Configuration/WindowCacheOptionsBuilder.cs index 11a169f..c6678c7 100644 --- a/src/SlidingWindowCache/Public/Configuration/WindowCacheOptionsBuilder.cs +++ b/src/Intervals.NET.Caching/Public/Configuration/WindowCacheOptionsBuilder.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Public.Configuration; +namespace Intervals.NET.Caching.Public.Configuration; /// /// Fluent builder for constructing instances with a clean, diff --git a/src/SlidingWindowCache/Public/Dto/CacheInteraction.cs b/src/Intervals.NET.Caching/Public/Dto/CacheInteraction.cs similarity index 98% rename from src/SlidingWindowCache/Public/Dto/CacheInteraction.cs rename to src/Intervals.NET.Caching/Public/Dto/CacheInteraction.cs index f43153c..5a9a7dd 100644 --- a/src/SlidingWindowCache/Public/Dto/CacheInteraction.cs +++ b/src/Intervals.NET.Caching/Public/Dto/CacheInteraction.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Public.Dto; +namespace Intervals.NET.Caching.Public.Dto; /// /// Describes how a data request was fulfilled relative to the current cache state. diff --git a/src/SlidingWindowCache/Public/Dto/RangeChunk.cs b/src/Intervals.NET.Caching/Public/Dto/RangeChunk.cs similarity index 86% rename from src/SlidingWindowCache/Public/Dto/RangeChunk.cs rename to src/Intervals.NET.Caching/Public/Dto/RangeChunk.cs index e049065..d7ef679 100644 --- a/src/SlidingWindowCache/Public/Dto/RangeChunk.cs +++ b/src/Intervals.NET.Caching/Public/Dto/RangeChunk.cs @@ -1,6 +1,6 @@ -using Intervals.NET; +using Intervals.NET; -namespace SlidingWindowCache.Public.Dto; +namespace Intervals.NET.Caching.Public.Dto; /// /// Represents a chunk of data associated with a specific range. This is used to encapsulate the data fetched for a particular range in the sliding window cache. @@ -24,8 +24,8 @@ namespace SlidingWindowCache.Public.Dto; /// Example - Bounded Database: /// /// // Database with records ID 100-500 -/// // Request [50..150] → Return RangeChunk([100..150], 51 records) -/// // Request [600..700] → Return RangeChunk(null, empty list) +/// // Request [50..150] > Return RangeChunk([100..150], 51 records) +/// // Request [600..700] > Return RangeChunk(null, empty list) /// /// public sealed record RangeChunk(Range? Range, IEnumerable Data) diff --git a/src/SlidingWindowCache/Public/Dto/RangeResult.cs b/src/Intervals.NET.Caching/Public/Dto/RangeResult.cs similarity index 98% rename from src/SlidingWindowCache/Public/Dto/RangeResult.cs rename to src/Intervals.NET.Caching/Public/Dto/RangeResult.cs index a00915d..4ca79fd 100644 --- a/src/SlidingWindowCache/Public/Dto/RangeResult.cs +++ b/src/Intervals.NET.Caching/Public/Dto/RangeResult.cs @@ -1,6 +1,6 @@ using Intervals.NET; -namespace SlidingWindowCache.Public.Dto; +namespace Intervals.NET.Caching.Public.Dto; /// /// Represents the result of a cache data request, containing the actual available range, data, diff --git a/src/SlidingWindowCache/Public/Extensions/WindowCacheConsistencyExtensions.cs b/src/Intervals.NET.Caching/Public/Extensions/WindowCacheConsistencyExtensions.cs similarity index 99% rename from src/SlidingWindowCache/Public/Extensions/WindowCacheConsistencyExtensions.cs rename to src/Intervals.NET.Caching/Public/Extensions/WindowCacheConsistencyExtensions.cs index 7ba6d6b..049577c 100644 --- a/src/SlidingWindowCache/Public/Extensions/WindowCacheConsistencyExtensions.cs +++ b/src/Intervals.NET.Caching/Public/Extensions/WindowCacheConsistencyExtensions.cs @@ -1,8 +1,8 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Public.Extensions; +namespace Intervals.NET.Caching.Public.Extensions; /// /// Extension methods for providing diff --git a/src/SlidingWindowCache/Public/FuncDataSource.cs b/src/Intervals.NET.Caching/Public/FuncDataSource.cs similarity index 97% rename from src/SlidingWindowCache/Public/FuncDataSource.cs rename to src/Intervals.NET.Caching/Public/FuncDataSource.cs index 7848ced..7267af2 100644 --- a/src/SlidingWindowCache/Public/FuncDataSource.cs +++ b/src/Intervals.NET.Caching/Public/FuncDataSource.cs @@ -1,7 +1,7 @@ using Intervals.NET; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Public; +namespace Intervals.NET.Caching.Public; /// /// An implementation that delegates diff --git a/src/SlidingWindowCache/Public/IDataSource.cs b/src/Intervals.NET.Caching/Public/IDataSource.cs similarity index 94% rename from src/SlidingWindowCache/Public/IDataSource.cs rename to src/Intervals.NET.Caching/Public/IDataSource.cs index e1a5765..81a7071 100644 --- a/src/SlidingWindowCache/Public/IDataSource.cs +++ b/src/Intervals.NET.Caching/Public/IDataSource.cs @@ -1,7 +1,7 @@ -using Intervals.NET; -using SlidingWindowCache.Public.Dto; +using Intervals.NET; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Public; +namespace Intervals.NET.Caching.Public; /// /// Defines the contract for data sources used in the sliding window cache. @@ -15,7 +15,7 @@ namespace SlidingWindowCache.Public; /// The type of data being fetched. /// /// -/// Quick Setup — FuncDataSource: +/// Quick Setup FuncDataSource: /// /// Use to create a data source from a delegate /// without defining a class: @@ -112,9 +112,9 @@ public interface IDataSource where TRange : IComparable /// } /// /// // Examples: - /// // Request [50..150] → RangeChunk([100..150], 51 records) - truncated at lower bound - /// // Request [400..600] → RangeChunk([400..500], 101 records) - truncated at upper bound - /// // Request [600..700] → RangeChunk(null, empty) - completely out of bounds + /// // Request [50..150] > RangeChunk([100..150], 51 records) - truncated at lower bound + /// // Request [400..600] > RangeChunk([400..500], 101 records) - truncated at upper bound + /// // Request [600..700] > RangeChunk(null, empty) - completely out of bounds /// /// See documentation on boundary handling for detailed guidance. /// diff --git a/src/SlidingWindowCache/Public/IWindowCache.cs b/src/Intervals.NET.Caching/Public/IWindowCache.cs similarity index 98% rename from src/SlidingWindowCache/Public/IWindowCache.cs rename to src/Intervals.NET.Caching/Public/IWindowCache.cs index e99e984..5dadf47 100644 --- a/src/SlidingWindowCache/Public/IWindowCache.cs +++ b/src/Intervals.NET.Caching/Public/IWindowCache.cs @@ -1,10 +1,10 @@ using Intervals.NET; using Intervals.NET.Domain.Abstractions; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Public; +namespace Intervals.NET.Caching.Public; /// /// Represents a sliding window cache that retrieves and caches data for specified ranges, diff --git a/src/SlidingWindowCache/Public/Instrumentation/EventCounterCacheDiagnostics.cs b/src/Intervals.NET.Caching/Public/Instrumentation/EventCounterCacheDiagnostics.cs similarity index 95% rename from src/SlidingWindowCache/Public/Instrumentation/EventCounterCacheDiagnostics.cs rename to src/Intervals.NET.Caching/Public/Instrumentation/EventCounterCacheDiagnostics.cs index 15e8010..87904fd 100644 --- a/src/SlidingWindowCache/Public/Instrumentation/EventCounterCacheDiagnostics.cs +++ b/src/Intervals.NET.Caching/Public/Instrumentation/EventCounterCacheDiagnostics.cs @@ -1,6 +1,6 @@ -using System.Diagnostics; +using System.Diagnostics; -namespace SlidingWindowCache.Public.Instrumentation; +namespace Intervals.NET.Caching.Public.Instrumentation; /// /// Default implementation of that uses thread-safe counters to track cache events and metrics. @@ -93,7 +93,7 @@ void ICacheDiagnostics.RebalanceExecutionFailed(Exception ex) { Interlocked.Increment(ref _rebalanceExecutionFailed); - // ⚠️ WARNING: This default implementation only writes to Debug output! + // ?? WARNING: This default implementation only writes to Debug output! // For production use, you MUST create a custom implementation that: // 1. Logs to your logging framework (e.g., ILogger, Serilog, NLog) // 2. Includes full exception details (message, stack trace, inner exceptions) @@ -101,7 +101,7 @@ void ICacheDiagnostics.RebalanceExecutionFailed(Exception ex) // // Example: // _logger.LogError(ex, "Cache rebalance execution failed. Cache may not be optimally sized."); - Debug.WriteLine($"⚠️ Rebalance execution failed: {ex}"); + Debug.WriteLine($"?? Rebalance execution failed: {ex}"); } /// @@ -120,7 +120,7 @@ void ICacheDiagnostics.RebalanceExecutionFailed(Exception ex) /// Resets all counters to zero. Use this before each test to ensure clean state. /// /// - /// Warning — not atomic: This method resets each counter individually using + /// Warning not atomic: This method resets each counter individually using /// . In a concurrent environment, another thread may increment a counter /// between two consecutive resets, leaving the object in a partially-reset state. Only call this /// method when you can guarantee that no other thread is mutating the counters (e.g., after diff --git a/src/SlidingWindowCache/Public/Instrumentation/ICacheDiagnostics.cs b/src/Intervals.NET.Caching/Public/Instrumentation/ICacheDiagnostics.cs similarity index 97% rename from src/SlidingWindowCache/Public/Instrumentation/ICacheDiagnostics.cs rename to src/Intervals.NET.Caching/Public/Instrumentation/ICacheDiagnostics.cs index 4a0738d..f0d02a6 100644 --- a/src/SlidingWindowCache/Public/Instrumentation/ICacheDiagnostics.cs +++ b/src/Intervals.NET.Caching/Public/Instrumentation/ICacheDiagnostics.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Public.Instrumentation; +namespace Intervals.NET.Caching.Public.Instrumentation; /// /// Instance-based diagnostics interface for tracking cache behavioral events in DEBUG mode. @@ -95,7 +95,7 @@ public interface ICacheDiagnostics /// (e.g., database min/max IDs, time-series with temporal limits, paginated APIs with max pages). /// /// - /// Context: User Thread (Partial Cache Hit — Scenario 3) and Background Thread (Rebalance Execution) + /// Context: User Thread (Partial Cache Hit Scenario 3) and Background Thread (Rebalance Execution) /// /// This is informational only - the system handles boundaries gracefully by skipping /// unavailable segments during cache union (UnionAll), preserving cache contiguity (Invariant A.12b). @@ -123,7 +123,7 @@ public interface ICacheDiagnostics /// Records publication of a rebalance intent by the User Path. /// Called after UserRequestHandler publishes an intent containing delivered data to IntentController. /// Intent is published only when the user request results in assembled data (assembledData != null). - /// Physical boundary misses — where IDataSource returns null for the requested range — do not produce an intent + /// Physical boundary misses where IDataSource returns null for the requested range do not produce an intent /// because there is no delivered data to embed in the intent (see Invariant C.8e). /// Location: IntentController.PublishIntent (after scheduler receives intent) /// Related: Invariant A.5 (User Path is sole source of rebalance intent), Invariant C.8e (Intent must contain delivered data) @@ -177,7 +177,7 @@ public interface ICacheDiagnostics /// Location: IntentController.RecordReason (RebalanceReason.WithinCurrentNoRebalanceRange) /// Related Invariants: /// - /// D.3: No rebalance if RequestedRange ⊆ CurrentNoRebalanceRange + /// D.3: No rebalance if RequestedRange ? CurrentNoRebalanceRange /// Stage 1 is the primary fast-path optimization /// /// @@ -243,7 +243,7 @@ public interface ICacheDiagnostics /// The exception that caused the rebalance execution to fail. This parameter provides details about the failure and can be used for logging and diagnostics. /// /// - /// ⚠️ CRITICAL: Applications MUST handle this event + /// ?? CRITICAL: Applications MUST handle this event /// /// Rebalance operations execute in fire-and-forget background tasks. When an exception occurs, /// the task catches it, records this event, and silently swallows the exception to prevent diff --git a/src/SlidingWindowCache/Public/Instrumentation/NoOpDiagnostics.cs b/src/Intervals.NET.Caching/Public/Instrumentation/NoOpDiagnostics.cs similarity index 97% rename from src/SlidingWindowCache/Public/Instrumentation/NoOpDiagnostics.cs rename to src/Intervals.NET.Caching/Public/Instrumentation/NoOpDiagnostics.cs index ac74b64..0d40439 100644 --- a/src/SlidingWindowCache/Public/Instrumentation/NoOpDiagnostics.cs +++ b/src/Intervals.NET.Caching/Public/Instrumentation/NoOpDiagnostics.cs @@ -1,4 +1,4 @@ -namespace SlidingWindowCache.Public.Instrumentation; +namespace Intervals.NET.Caching.Public.Instrumentation; /// /// No-op implementation of ICacheDiagnostics for production use where performance is critical and diagnostics are not needed. diff --git a/tests/SlidingWindowCache.Integration.Tests/BoundaryHandlingTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/BoundaryHandlingTests.cs similarity index 98% rename from tests/SlidingWindowCache.Integration.Tests/BoundaryHandlingTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/BoundaryHandlingTests.cs index 53899df..046884b 100644 --- a/tests/SlidingWindowCache.Integration.Tests/BoundaryHandlingTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/BoundaryHandlingTests.cs @@ -1,11 +1,11 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// /// Tests that validate boundary handling when the data source has physical limits. diff --git a/tests/SlidingWindowCache.Integration.Tests/CacheDataSourceInteractionTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/CacheDataSourceInteractionTests.cs similarity index 97% rename from tests/SlidingWindowCache.Integration.Tests/CacheDataSourceInteractionTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/CacheDataSourceInteractionTests.cs index 3787d39..70ee671 100644 --- a/tests/SlidingWindowCache.Integration.Tests/CacheDataSourceInteractionTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/CacheDataSourceInteractionTests.cs @@ -1,12 +1,12 @@ using Intervals.NET.Domain.Default.Numeric; using Intervals.NET.Domain.Extensions.Fixed; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// /// Tests validating the interaction contract between WindowCache and IDataSource. diff --git a/tests/SlidingWindowCache.Integration.Tests/ConcurrencyStabilityTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/ConcurrencyStabilityTests.cs similarity index 97% rename from tests/SlidingWindowCache.Integration.Tests/ConcurrencyStabilityTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/ConcurrencyStabilityTests.cs index 5cc3eb9..37c46be 100644 --- a/tests/SlidingWindowCache.Integration.Tests/ConcurrencyStabilityTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/ConcurrencyStabilityTests.cs @@ -1,12 +1,12 @@ using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// /// Concurrency and stress stability tests for WindowCache. diff --git a/tests/SlidingWindowCache.Integration.Tests/DataSourceRangePropagationTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/DataSourceRangePropagationTests.cs similarity index 98% rename from tests/SlidingWindowCache.Integration.Tests/DataSourceRangePropagationTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/DataSourceRangePropagationTests.cs index 04d33de..13006e3 100644 --- a/tests/SlidingWindowCache.Integration.Tests/DataSourceRangePropagationTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/DataSourceRangePropagationTests.cs @@ -1,11 +1,11 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// /// Tests that validate the EXACT ranges propagated to IDataSource in different cache scenarios. diff --git a/tests/SlidingWindowCache.Integration.Tests/ExecutionStrategySelectionTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/ExecutionStrategySelectionTests.cs similarity index 97% rename from tests/SlidingWindowCache.Integration.Tests/ExecutionStrategySelectionTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/ExecutionStrategySelectionTests.cs index 08b1def..64968c4 100644 --- a/tests/SlidingWindowCache.Integration.Tests/ExecutionStrategySelectionTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/ExecutionStrategySelectionTests.cs @@ -1,11 +1,11 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Dto; -using SlidingWindowCache.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Dto; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// /// Integration tests verifying the execution strategy selection based on WindowCacheOptions.RebalanceQueueCapacity. diff --git a/tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj b/tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj similarity index 53% rename from tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj rename to tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj index 5b3e712..32e2134 100644 --- a/tests/SlidingWindowCache.Integration.Tests/SlidingWindowCache.Integration.Tests.csproj +++ b/tests/Intervals.NET.Caching.Integration.Tests/Intervals.NET.Caching.Integration.Tests.csproj @@ -10,11 +10,17 @@ - - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + @@ -25,8 +31,8 @@ - - + + diff --git a/tests/SlidingWindowCache.Integration.Tests/LayeredCacheIntegrationTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/LayeredCacheIntegrationTests.cs similarity index 97% rename from tests/SlidingWindowCache.Integration.Tests/LayeredCacheIntegrationTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/LayeredCacheIntegrationTests.cs index a35b2bb..e41314c 100644 --- a/tests/SlidingWindowCache.Integration.Tests/LayeredCacheIntegrationTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/LayeredCacheIntegrationTests.cs @@ -1,12 +1,12 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Extensions; -using SlidingWindowCache.Public.Instrumentation; -using SlidingWindowCache.Tests.Infrastructure.DataSources; - -namespace SlidingWindowCache.Integration.Tests; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Extensions; +using Intervals.NET.Caching.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; + +namespace Intervals.NET.Caching.Integration.Tests; /// /// Integration tests for the layered cache feature: diff --git a/tests/SlidingWindowCache.Integration.Tests/RandomRangeRobustnessTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/RandomRangeRobustnessTests.cs similarity index 96% rename from tests/SlidingWindowCache.Integration.Tests/RandomRangeRobustnessTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/RandomRangeRobustnessTests.cs index 95db41a..46ff318 100644 --- a/tests/SlidingWindowCache.Integration.Tests/RandomRangeRobustnessTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/RandomRangeRobustnessTests.cs @@ -1,13 +1,13 @@ using Intervals.NET; using Intervals.NET.Domain.Default.Numeric; using Intervals.NET.Domain.Extensions.Fixed; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// /// Property-based robustness tests using randomized range requests. diff --git a/tests/SlidingWindowCache.Integration.Tests/RangeSemanticsContractTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/RangeSemanticsContractTests.cs similarity index 96% rename from tests/SlidingWindowCache.Integration.Tests/RangeSemanticsContractTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/RangeSemanticsContractTests.cs index a17067c..b8c2e67 100644 --- a/tests/SlidingWindowCache.Integration.Tests/RangeSemanticsContractTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/RangeSemanticsContractTests.cs @@ -1,15 +1,15 @@ using Intervals.NET.Domain.Default.Numeric; using Intervals.NET.Domain.Extensions.Fixed; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// -/// Tests that validate SlidingWindowCache assumptions about range semantics and behavior. +/// Tests that validate Intervals.NET.Caching assumptions about range semantics and behavior. /// These tests focus on observable contract validation rather than internal implementation. /// /// Goal: Verify that range operations behave as expected regarding: diff --git a/tests/SlidingWindowCache.Integration.Tests/RebalanceExceptionHandlingTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/RebalanceExceptionHandlingTests.cs similarity index 97% rename from tests/SlidingWindowCache.Integration.Tests/RebalanceExceptionHandlingTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/RebalanceExceptionHandlingTests.cs index 5724127..214742f 100644 --- a/tests/SlidingWindowCache.Integration.Tests/RebalanceExceptionHandlingTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/RebalanceExceptionHandlingTests.cs @@ -1,11 +1,11 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// /// Tests for validating proper exception handling in background rebalance operations. diff --git a/tests/SlidingWindowCache.Integration.Tests/RuntimeOptionsUpdateTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/RuntimeOptionsUpdateTests.cs similarity index 98% rename from tests/SlidingWindowCache.Integration.Tests/RuntimeOptionsUpdateTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/RuntimeOptionsUpdateTests.cs index 2635885..1c4dedc 100644 --- a/tests/SlidingWindowCache.Integration.Tests/RuntimeOptionsUpdateTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/RuntimeOptionsUpdateTests.cs @@ -1,10 +1,10 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// /// Integration tests for . diff --git a/tests/SlidingWindowCache.Integration.Tests/StrongConsistencyModeTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/StrongConsistencyModeTests.cs similarity index 97% rename from tests/SlidingWindowCache.Integration.Tests/StrongConsistencyModeTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/StrongConsistencyModeTests.cs index e8f06a5..620b5aa 100644 --- a/tests/SlidingWindowCache.Integration.Tests/StrongConsistencyModeTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/StrongConsistencyModeTests.cs @@ -1,12 +1,12 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Tests.Infrastructure.Helpers; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Extensions; -using SlidingWindowCache.Public.Instrumentation; - -namespace SlidingWindowCache.Integration.Tests; +using Intervals.NET.Caching.Tests.Infrastructure.Helpers; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Extensions; +using Intervals.NET.Caching.Public.Instrumentation; + +namespace Intervals.NET.Caching.Integration.Tests; /// /// Integration tests for the strong consistency mode exposed by diff --git a/tests/SlidingWindowCache.Integration.Tests/UserPathExceptionHandlingTests.cs b/tests/Intervals.NET.Caching.Integration.Tests/UserPathExceptionHandlingTests.cs similarity index 94% rename from tests/SlidingWindowCache.Integration.Tests/UserPathExceptionHandlingTests.cs rename to tests/Intervals.NET.Caching.Integration.Tests/UserPathExceptionHandlingTests.cs index a50493e..acbe504 100644 --- a/tests/SlidingWindowCache.Integration.Tests/UserPathExceptionHandlingTests.cs +++ b/tests/Intervals.NET.Caching.Integration.Tests/UserPathExceptionHandlingTests.cs @@ -1,11 +1,11 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Integration.Tests; +namespace Intervals.NET.Caching.Integration.Tests; /// /// Tests for validating proper exception handling in User Path operations. diff --git a/tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj b/tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj similarity index 54% rename from tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj rename to tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj index c5d97e5..181fcc4 100644 --- a/tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj +++ b/tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj @@ -10,11 +10,17 @@ - - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -28,8 +34,8 @@ - - + + diff --git a/tests/SlidingWindowCache.Invariants.Tests/README.md b/tests/Intervals.NET.Caching.Invariants.Tests/README.md similarity index 95% rename from tests/SlidingWindowCache.Invariants.Tests/README.md rename to tests/Intervals.NET.Caching.Invariants.Tests/README.md index 65273c5..b0d11b9 100644 --- a/tests/SlidingWindowCache.Invariants.Tests/README.md +++ b/tests/Intervals.NET.Caching.Invariants.Tests/README.md @@ -1,4 +1,4 @@ -# WindowCache Invariant Tests - Implementation Summary +# WindowCache Invariant Tests - Implementation Summary ## Overview Comprehensive unit test suite for the WindowCache library verifying system invariants through the public API using DEBUG-only instrumentation counters. @@ -17,7 +17,7 @@ Comprehensive unit test suite for the WindowCache library verifying system invar - Added 7 new gap tests for previously untested invariants - Converted 7 tests to Theory with execution strategy parameterization (2x coverage) - Converted 3 tests to Theory with storage strategy parameterization (2x coverage) - - Total new test cases: 16 (from 29 → 45, +55% increase) + - Total new test cases: 16 (from 29 > 45, +55% increase) ## Recent Test Suite Enhancements @@ -51,7 +51,7 @@ Tests now validate behavior across **both storage strategies**: - **CopyOnRead** (`UserCacheReadMode.CopyOnRead`) - Defensive copies, cheaper rematerialization Converted tests: -- `Invariant_A_12_UserPathNeverMutatesCache` (3 scenarios × 2 storage = 6 test cases) +- `Invariant_A_12_UserPathNeverMutatesCache` (3 scenarios ? 2 storage = 6 test cases) - `Invariant_F_2a_RebalanceNormalizesCache` - `Invariant_F_6_F_7_F_8_PostExecutionGuarantees` @@ -63,13 +63,13 @@ Converted tests: ### Coverage Summary - **New gap tests**: 7 tests covering previously untested architectural invariants - **Parameterized tests**: 7 tests now run across multiple strategies (14+ test cases) -- **Total increase**: +55% test coverage (29 → 45 test cases) +- **Total increase**: +55% test coverage (29 > 45 test cases) - **Execution time**: ~14 seconds (from ~7 seconds, +100% due to strategy combinations) ## Implementation Details ### 1. Instrumentation (Public) -- **Location**: `src/SlidingWindowCache/Public/Instrumentation/` +- **Location**: `src/Intervals.NET.Caching/Public/Instrumentation/` - **Files**: - `ICacheDiagnostics.cs` - Public interface for cache event tracking - `EventCounterCacheDiagnostics.cs` - Thread-safe counter implementation @@ -100,7 +100,7 @@ Converted tests: not actual cache mutations. Actual mutations only occur in Rebalance Execution via `Rematerialize()`. ### 2. Deterministic Synchronization Infrastructure -- **Location**: `tests/SlidingWindowCache.Invariants.Tests/TestInfrastructure/` +- **Location**: `tests/Intervals.NET.Caching.Invariants.Tests/TestInfrastructure/` - **Files Created**: - `TestHelpers.cs` - Factory methods, data verification, and deterministic synchronization utilities @@ -108,10 +108,10 @@ not actual cache mutations. Actual mutations only occur in Rebalance Execution v - **Method**: `cache.WaitForIdleAsync()` - Waits until the system was idle at some point - **Mechanism**: Observe-and-stabilize pattern based on Task reference tracking (not counter polling) - **Benefits**: - - ✅ Race-free: No timing dependencies or polling intervals - - ✅ Deterministic: Guaranteed idle state when method returns - - ✅ Fast: Completes immediately when background work finishes - - ✅ Reliable: Works under concurrent intent cancellation and rescheduling + - ? Race-free: No timing dependencies or polling intervals + - ? Deterministic: Guaranteed idle state when method returns + - ? Fast: Completes immediately when background work finishes + - ? Reliable: Works under concurrent intent cancellation and rescheduling - **Implementation Details**: - **`AsyncActivityCounter`** tracks active operations (intents + executions) using lock-free `Interlocked` operations to support `WaitForIdleAsync()` @@ -132,16 +132,16 @@ not actual cache mutations. Actual mutations only occur in Rebalance Execution v - Properly calculates range spans using Intervals.NET domain ### 3. Test Project Configuration -- **Updated**: `SlidingWindowCache.Invariants.Tests.csproj` +- **Updated**: `Intervals.NET.Caching.Invariants.Tests.csproj` - **Added Dependencies**: - `Moq` (Version 4.20.70) - For IDataSource mocking - `xUnit` - Test framework - `Intervals.NET` packages - Domain and range handling - - Project reference to `SlidingWindowCache` + - Project reference to `Intervals.NET.Caching` - **Framework**: xUnit with standard `Assert` class (not FluentAssertions - decision for consistency) ### 4. Comprehensive Test Suite -- **Location**: `tests/SlidingWindowCache.Invariants.Tests/WindowCacheInvariantTests.cs` +- **Location**: `tests/Intervals.NET.Caching.Invariants.Tests/WindowCacheInvariantTests.cs` - **Test Count**: 26 test methods (29 individual xUnit test cases) - **Test Structure**: Each test method references its invariant number and description @@ -153,7 +153,7 @@ not actual cache mutations. Actual mutations only occur in Rebalance Execution v - A.3: User path always serves requests - A.4: User path never waits for rebalance - A.10: User always receives exact requested range -- A.12: User Path never mutates cache [Theory: 3 scenarios × 2 storage strategies = 6 tests] +- A.12: User Path never mutates cache [Theory: 3 scenarios ? 2 storage strategies = 6 tests] - A.12b: Cache contiguity maintained **B. Cache State & Consistency (4 tests)** @@ -272,7 +272,7 @@ not actual cache mutations. Actual mutations only occur in Rebalance Execution v ```bash # Run all invariant tests -dotnet test tests/SlidingWindowCache.Invariants.Tests/SlidingWindowCache.Invariants.Tests.csproj --configuration Debug +dotnet test tests/Intervals.NET.Caching.Invariants.Tests/Intervals.NET.Caching.Invariants.Tests.csproj --configuration Debug # Run specific test dotnet test --filter "FullyQualifiedName~Invariant_D_4_SkipWhenDesiredEqualsCurrentRange" diff --git a/tests/SlidingWindowCache.Invariants.Tests/WindowCacheInvariantTests.cs b/tests/Intervals.NET.Caching.Invariants.Tests/WindowCacheInvariantTests.cs similarity index 99% rename from tests/SlidingWindowCache.Invariants.Tests/WindowCacheInvariantTests.cs rename to tests/Intervals.NET.Caching.Invariants.Tests/WindowCacheInvariantTests.cs index a82728f..00d989f 100644 --- a/tests/SlidingWindowCache.Invariants.Tests/WindowCacheInvariantTests.cs +++ b/tests/Intervals.NET.Caching.Invariants.Tests/WindowCacheInvariantTests.cs @@ -1,14 +1,14 @@ using Intervals.NET.Domain.Default.Numeric; using Intervals.NET.Domain.Extensions.Fixed; using Intervals.NET.Extensions; -using SlidingWindowCache.Tests.Infrastructure.Helpers; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Extensions; -using SlidingWindowCache.Public.Instrumentation; - -namespace SlidingWindowCache.Invariants.Tests; +using Intervals.NET.Caching.Tests.Infrastructure.Helpers; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Extensions; +using Intervals.NET.Caching.Public.Instrumentation; + +namespace Intervals.NET.Caching.Invariants.Tests; /// /// Comprehensive test suite verifying all 56 system invariants for WindowCache. diff --git a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/BoundedDataSource.cs b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/BoundedDataSource.cs similarity index 94% rename from tests/SlidingWindowCache.Tests.Infrastructure/DataSources/BoundedDataSource.cs rename to tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/BoundedDataSource.cs index 18a6c45..4865e7e 100644 --- a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/BoundedDataSource.cs +++ b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/BoundedDataSource.cs @@ -1,9 +1,9 @@ using Intervals.NET; using Intervals.NET.Extensions; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Tests.Infrastructure.DataSources; +namespace Intervals.NET.Caching.Tests.Infrastructure.DataSources; /// /// A test IDataSource implementation that simulates a bounded data source with physical limits. diff --git a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/DataGenerationHelpers.cs b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/DataGenerationHelpers.cs similarity index 96% rename from tests/SlidingWindowCache.Tests.Infrastructure/DataSources/DataGenerationHelpers.cs rename to tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/DataGenerationHelpers.cs index 8372b82..aec00f8 100644 --- a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/DataGenerationHelpers.cs +++ b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/DataGenerationHelpers.cs @@ -1,6 +1,6 @@ using Intervals.NET; -namespace SlidingWindowCache.Tests.Infrastructure.DataSources; +namespace Intervals.NET.Caching.Tests.Infrastructure.DataSources; /// /// Shared data generation logic for test data sources. diff --git a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/FaultyDataSource.cs b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/FaultyDataSource.cs similarity index 94% rename from tests/SlidingWindowCache.Tests.Infrastructure/DataSources/FaultyDataSource.cs rename to tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/FaultyDataSource.cs index c7b4c3d..2354a91 100644 --- a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/FaultyDataSource.cs +++ b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/FaultyDataSource.cs @@ -1,8 +1,8 @@ using Intervals.NET; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Tests.Infrastructure.DataSources; +namespace Intervals.NET.Caching.Tests.Infrastructure.DataSources; /// /// A configurable IDataSource that delegates fetch calls through a user-supplied callback, diff --git a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/SimpleTestDataSource.cs b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/SimpleTestDataSource.cs similarity index 95% rename from tests/SlidingWindowCache.Tests.Infrastructure/DataSources/SimpleTestDataSource.cs rename to tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/SimpleTestDataSource.cs index fef1a4b..6501b9b 100644 --- a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/SimpleTestDataSource.cs +++ b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/SimpleTestDataSource.cs @@ -1,8 +1,8 @@ using Intervals.NET; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Tests.Infrastructure.DataSources; +namespace Intervals.NET.Caching.Tests.Infrastructure.DataSources; /// /// A minimal generic test data source that generates data for any requested range diff --git a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/SpyDataSource.cs b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/SpyDataSource.cs similarity index 96% rename from tests/SlidingWindowCache.Tests.Infrastructure/DataSources/SpyDataSource.cs rename to tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/SpyDataSource.cs index 278f25c..b379207 100644 --- a/tests/SlidingWindowCache.Tests.Infrastructure/DataSources/SpyDataSource.cs +++ b/tests/Intervals.NET.Caching.Tests.Infrastructure/DataSources/SpyDataSource.cs @@ -1,9 +1,9 @@ using System.Collections.Concurrent; using Intervals.NET; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Tests.Infrastructure.DataSources; +namespace Intervals.NET.Caching.Tests.Infrastructure.DataSources; /// /// A test spy/fake IDataSource implementation that records all fetch calls for verification. diff --git a/tests/SlidingWindowCache.Tests.Infrastructure/Helpers/TestHelpers.cs b/tests/Intervals.NET.Caching.Tests.Infrastructure/Helpers/TestHelpers.cs similarity index 98% rename from tests/SlidingWindowCache.Tests.Infrastructure/Helpers/TestHelpers.cs rename to tests/Intervals.NET.Caching.Tests.Infrastructure/Helpers/TestHelpers.cs index cecb6d2..bd30aa0 100644 --- a/tests/SlidingWindowCache.Tests.Infrastructure/Helpers/TestHelpers.cs +++ b/tests/Intervals.NET.Caching.Tests.Infrastructure/Helpers/TestHelpers.cs @@ -2,14 +2,14 @@ using Intervals.NET.Domain.Default.Numeric; using Intervals.NET.Domain.Extensions.Fixed; using Moq; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Dto; -using SlidingWindowCache.Public.Instrumentation; -using SlidingWindowCache.Tests.Infrastructure.DataSources; - -namespace SlidingWindowCache.Tests.Infrastructure.Helpers; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Dto; +using Intervals.NET.Caching.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; + +namespace Intervals.NET.Caching.Tests.Infrastructure.Helpers; /// /// Helper methods for creating test components. diff --git a/tests/SlidingWindowCache.Tests.Infrastructure/SlidingWindowCache.Tests.Infrastructure.csproj b/tests/Intervals.NET.Caching.Tests.Infrastructure/Intervals.NET.Caching.Tests.Infrastructure.csproj similarity index 75% rename from tests/SlidingWindowCache.Tests.Infrastructure/SlidingWindowCache.Tests.Infrastructure.csproj rename to tests/Intervals.NET.Caching.Tests.Infrastructure/Intervals.NET.Caching.Tests.Infrastructure.csproj index 1a57a00..1fbf890 100644 --- a/tests/SlidingWindowCache.Tests.Infrastructure/SlidingWindowCache.Tests.Infrastructure.csproj +++ b/tests/Intervals.NET.Caching.Tests.Infrastructure/Intervals.NET.Caching.Tests.Infrastructure.csproj @@ -13,8 +13,8 @@ - - + + @@ -22,7 +22,7 @@ - + diff --git a/tests/SlidingWindowCache.Unit.Tests/Core/State/RuntimeCacheOptionsHolderTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Core/State/RuntimeCacheOptionsHolderTests.cs similarity index 97% rename from tests/SlidingWindowCache.Unit.Tests/Core/State/RuntimeCacheOptionsHolderTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Core/State/RuntimeCacheOptionsHolderTests.cs index e05e2fc..bac74e2 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Core/State/RuntimeCacheOptionsHolderTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Core/State/RuntimeCacheOptionsHolderTests.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Core.State; +using Intervals.NET.Caching.Core.State; -namespace SlidingWindowCache.Unit.Tests.Core.State; +namespace Intervals.NET.Caching.Unit.Tests.Core.State; /// /// Unit tests for verifying atomic read/write semantics. diff --git a/tests/SlidingWindowCache.Unit.Tests/Core/State/RuntimeCacheOptionsTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Core/State/RuntimeCacheOptionsTests.cs similarity index 98% rename from tests/SlidingWindowCache.Unit.Tests/Core/State/RuntimeCacheOptionsTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Core/State/RuntimeCacheOptionsTests.cs index a8406a8..ce5536c 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Core/State/RuntimeCacheOptionsTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Core/State/RuntimeCacheOptionsTests.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Core.State; +using Intervals.NET.Caching.Core.State; -namespace SlidingWindowCache.Unit.Tests.Core.State; +namespace Intervals.NET.Caching.Unit.Tests.Core.State; /// /// Unit tests for that verify validation logic and property initialization. diff --git a/tests/SlidingWindowCache.Unit.Tests/Core/State/RuntimeOptionsValidatorTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Core/State/RuntimeOptionsValidatorTests.cs similarity index 98% rename from tests/SlidingWindowCache.Unit.Tests/Core/State/RuntimeOptionsValidatorTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Core/State/RuntimeOptionsValidatorTests.cs index f92bc16..2f8b0e5 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Core/State/RuntimeOptionsValidatorTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Core/State/RuntimeOptionsValidatorTests.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Core.State; +using Intervals.NET.Caching.Core.State; -namespace SlidingWindowCache.Unit.Tests.Core.State; +namespace Intervals.NET.Caching.Unit.Tests.Core.State; /// /// Unit tests for that verify all shared validation rules diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/AsyncActivityCounterTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/AsyncActivityCounterTests.cs similarity index 95% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/AsyncActivityCounterTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/AsyncActivityCounterTests.cs index 8776e7a..2520556 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/AsyncActivityCounterTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/AsyncActivityCounterTests.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Infrastructure.Concurrency; +using Intervals.NET.Caching.Infrastructure.Concurrency; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Concurrency; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Concurrency; /// /// Unit tests for AsyncActivityCounter. diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/CacheDataExtensionServiceTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/CacheDataExtensionServiceTests.cs similarity index 85% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/CacheDataExtensionServiceTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/CacheDataExtensionServiceTests.cs index 5afffb7..086cb61 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/CacheDataExtensionServiceTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/CacheDataExtensionServiceTests.cs @@ -2,13 +2,13 @@ using Intervals.NET.Data.Extensions; using Intervals.NET.Domain.Default.Numeric; using Moq; -using SlidingWindowCache.Core.Rebalance.Execution; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Instrumentation; -using SlidingWindowCache.Public.Dto; -using SlidingWindowCache.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Core.Rebalance.Execution; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Instrumentation; +using Intervals.NET.Caching.Public.Dto; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Concurrency; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Concurrency; /// /// Unit tests for CacheDataExtensionService. diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/ExecutionRequestTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/ExecutionRequestTests.cs similarity index 86% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/ExecutionRequestTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/ExecutionRequestTests.cs index 0d219ca..7c6805a 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/ExecutionRequestTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/ExecutionRequestTests.cs @@ -1,10 +1,10 @@ using Intervals.NET.Data.Extensions; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Core.Rebalance.Execution; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Core.Rebalance.Execution; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Concurrency; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Concurrency; /// /// Unit tests for ExecutionRequest lifecycle behavior. diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/TaskBasedRebalanceExecutionControllerTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/TaskBasedRebalanceExecutionControllerTests.cs similarity index 85% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/TaskBasedRebalanceExecutionControllerTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/TaskBasedRebalanceExecutionControllerTests.cs index 8c59d5f..e506751 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Concurrency/TaskBasedRebalanceExecutionControllerTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Concurrency/TaskBasedRebalanceExecutionControllerTests.cs @@ -1,15 +1,15 @@ using System.Reflection; using Intervals.NET.Data.Extensions; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Core.Rebalance.Execution; -using SlidingWindowCache.Core.Rebalance.Intent; -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Infrastructure.Concurrency; -using SlidingWindowCache.Infrastructure.Storage; -using SlidingWindowCache.Public.Instrumentation; -using SlidingWindowCache.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Core.Rebalance.Execution; +using Intervals.NET.Caching.Core.Rebalance.Intent; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Infrastructure.Concurrency; +using Intervals.NET.Caching.Infrastructure.Storage; +using Intervals.NET.Caching.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Concurrency; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Concurrency; /// /// Unit tests for TaskBasedRebalanceExecutionController. diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Extensions/IntegerVariableStepDomain.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Extensions/IntegerVariableStepDomain.cs similarity index 98% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Extensions/IntegerVariableStepDomain.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Extensions/IntegerVariableStepDomain.cs index 3f2f60f..21cc493 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Extensions/IntegerVariableStepDomain.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Extensions/IntegerVariableStepDomain.cs @@ -1,6 +1,6 @@ using Intervals.NET.Domain.Abstractions; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Extensions; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Extensions; /// /// Test implementation of IVariableStepDomain for integer values with custom step sizes. diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Extensions/IntervalsNetDomainExtensionsTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Extensions/IntervalsNetDomainExtensionsTests.cs similarity index 99% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Extensions/IntervalsNetDomainExtensionsTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Extensions/IntervalsNetDomainExtensionsTests.cs index 6459e29..4eebc36 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Extensions/IntervalsNetDomainExtensionsTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Extensions/IntervalsNetDomainExtensionsTests.cs @@ -1,9 +1,9 @@ using Intervals.NET.Domain.Abstractions; using Intervals.NET.Domain.Default.Numeric; using Moq; -using SlidingWindowCache.Infrastructure.Extensions; +using Intervals.NET.Caching.Infrastructure.Extensions; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Extensions; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Extensions; /// /// Unit tests for IntervalsNetDomainExtensions that verify domain-agnostic extension methods diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/CopyOnReadStorageTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/CopyOnReadStorageTests.cs similarity index 95% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/CopyOnReadStorageTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/CopyOnReadStorageTests.cs index 7f1b712..be4f6c3 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/CopyOnReadStorageTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/CopyOnReadStorageTests.cs @@ -1,11 +1,11 @@ using Intervals.NET.Data.Extensions; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Infrastructure.Storage; -using SlidingWindowCache.Unit.Tests.Infrastructure.Extensions; -using SlidingWindowCache.Unit.Tests.Infrastructure.Storage.TestInfrastructure; -using static SlidingWindowCache.Unit.Tests.Infrastructure.Storage.TestInfrastructure.StorageTestHelpers; +using Intervals.NET.Caching.Infrastructure.Storage; +using Intervals.NET.Caching.Unit.Tests.Infrastructure.Extensions; +using Intervals.NET.Caching.Unit.Tests.Infrastructure.Storage.TestInfrastructure; +using static Intervals.NET.Caching.Unit.Tests.Infrastructure.Storage.TestInfrastructure.StorageTestHelpers; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Storage; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Storage; /// /// Unit tests for CopyOnReadStorage that verify the ICacheStorage interface contract, diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/SnapshotReadStorageTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/SnapshotReadStorageTests.cs similarity index 72% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/SnapshotReadStorageTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/SnapshotReadStorageTests.cs index bca702d..60589bc 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/SnapshotReadStorageTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/SnapshotReadStorageTests.cs @@ -1,9 +1,9 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Infrastructure.Storage; -using SlidingWindowCache.Unit.Tests.Infrastructure.Extensions; -using SlidingWindowCache.Unit.Tests.Infrastructure.Storage.TestInfrastructure; +using Intervals.NET.Caching.Infrastructure.Storage; +using Intervals.NET.Caching.Unit.Tests.Infrastructure.Extensions; +using Intervals.NET.Caching.Unit.Tests.Infrastructure.Storage.TestInfrastructure; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Storage; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Storage; /// /// Unit tests for SnapshotReadStorage that verify the ICacheStorage interface contract, diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/TestInfrastructure/CacheStorageTestsBase.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/TestInfrastructure/CacheStorageTestsBase.cs similarity index 97% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/TestInfrastructure/CacheStorageTestsBase.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/TestInfrastructure/CacheStorageTestsBase.cs index 197a2c1..4f6c76c 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/TestInfrastructure/CacheStorageTestsBase.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/TestInfrastructure/CacheStorageTestsBase.cs @@ -1,10 +1,10 @@ using Intervals.NET.Data.Extensions; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Infrastructure.Storage; -using SlidingWindowCache.Unit.Tests.Infrastructure.Extensions; -using static SlidingWindowCache.Unit.Tests.Infrastructure.Storage.TestInfrastructure.StorageTestHelpers; +using Intervals.NET.Caching.Infrastructure.Storage; +using Intervals.NET.Caching.Unit.Tests.Infrastructure.Extensions; +using static Intervals.NET.Caching.Unit.Tests.Infrastructure.Storage.TestInfrastructure.StorageTestHelpers; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Storage.TestInfrastructure; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Storage.TestInfrastructure; /// /// Abstract base class providing shared test coverage for all diff --git a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/TestInfrastructure/StorageTestHelpers.cs b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/TestInfrastructure/StorageTestHelpers.cs similarity index 97% rename from tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/TestInfrastructure/StorageTestHelpers.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/TestInfrastructure/StorageTestHelpers.cs index eb85ff4..e178bc8 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Infrastructure/Storage/TestInfrastructure/StorageTestHelpers.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Infrastructure/Storage/TestInfrastructure/StorageTestHelpers.cs @@ -4,7 +4,7 @@ using Intervals.NET.Domain.Abstractions; using Intervals.NET.Domain.Default.Numeric; -namespace SlidingWindowCache.Unit.Tests.Infrastructure.Storage.TestInfrastructure; +namespace Intervals.NET.Caching.Unit.Tests.Infrastructure.Storage.TestInfrastructure; /// /// Shared test helpers for storage implementation tests. diff --git a/tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj b/tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj similarity index 53% rename from tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj rename to tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj index 4a3d19b..dea3092 100644 --- a/tests/SlidingWindowCache.Unit.Tests/SlidingWindowCache.Unit.Tests.csproj +++ b/tests/Intervals.NET.Caching.Unit.Tests/Intervals.NET.Caching.Unit.Tests.csproj @@ -10,14 +10,20 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -25,8 +31,8 @@ - - + + diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/LayeredWindowCacheBuilderTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/LayeredWindowCacheBuilderTests.cs similarity index 97% rename from tests/SlidingWindowCache.Unit.Tests/Public/Cache/LayeredWindowCacheBuilderTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/LayeredWindowCacheBuilderTests.cs index 18b76ae..2ae13aa 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/LayeredWindowCacheBuilderTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/LayeredWindowCacheBuilderTests.cs @@ -1,13 +1,13 @@ using Intervals.NET.Domain.Abstractions; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Tests.Infrastructure.Helpers; - -namespace SlidingWindowCache.Unit.Tests.Public.Cache; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Tests.Infrastructure.Helpers; + +namespace Intervals.NET.Caching.Unit.Tests.Public.Cache; /// /// Unit tests for . diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/LayeredWindowCacheTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/LayeredWindowCacheTests.cs similarity index 98% rename from tests/SlidingWindowCache.Unit.Tests/Public/Cache/LayeredWindowCacheTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/LayeredWindowCacheTests.cs index 308e74e..e9755c0 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/LayeredWindowCacheTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/LayeredWindowCacheTests.cs @@ -1,11 +1,11 @@ using Intervals.NET.Domain.Default.Numeric; using Moq; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Unit.Tests.Public.Cache; +namespace Intervals.NET.Caching.Unit.Tests.Public.Cache; /// /// Unit tests for . diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/WindowCacheBuilderTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/WindowCacheBuilderTests.cs similarity index 97% rename from tests/SlidingWindowCache.Unit.Tests/Public/Cache/WindowCacheBuilderTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/WindowCacheBuilderTests.cs index c50376a..8e90add 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/WindowCacheBuilderTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/WindowCacheBuilderTests.cs @@ -1,13 +1,13 @@ using Intervals.NET.Domain.Abstractions; using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Public.Instrumentation; -using SlidingWindowCache.Tests.Infrastructure.DataSources; -using SlidingWindowCache.Tests.Infrastructure.Helpers; - -namespace SlidingWindowCache.Unit.Tests.Public.Cache; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Public.Instrumentation; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Tests.Infrastructure.Helpers; + +namespace Intervals.NET.Caching.Unit.Tests.Public.Cache; /// /// Unit tests for (static entry point) and diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/WindowCacheDataSourceAdapterTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/WindowCacheDataSourceAdapterTests.cs similarity index 98% rename from tests/SlidingWindowCache.Unit.Tests/Public/Cache/WindowCacheDataSourceAdapterTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/WindowCacheDataSourceAdapterTests.cs index d32ff6c..41814cf 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/WindowCacheDataSourceAdapterTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/WindowCacheDataSourceAdapterTests.cs @@ -1,11 +1,11 @@ using Intervals.NET.Domain.Default.Numeric; using Moq; -using SlidingWindowCache.Infrastructure.Collections; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Infrastructure.Collections; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Unit.Tests.Public.Cache; +namespace Intervals.NET.Caching.Unit.Tests.Public.Cache; /// /// Unit tests for . diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/WindowCacheDisposalTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/WindowCacheDisposalTests.cs similarity index 98% rename from tests/SlidingWindowCache.Unit.Tests/Public/Cache/WindowCacheDisposalTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/WindowCacheDisposalTests.cs index f08dc8e..0ca892c 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Cache/WindowCacheDisposalTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Cache/WindowCacheDisposalTests.cs @@ -1,9 +1,9 @@ using Intervals.NET.Domain.Default.Numeric; -using SlidingWindowCache.Public.Cache; -using SlidingWindowCache.Public.Configuration; -using SlidingWindowCache.Tests.Infrastructure.DataSources; +using Intervals.NET.Caching.Public.Cache; +using Intervals.NET.Caching.Public.Configuration; +using Intervals.NET.Caching.Tests.Infrastructure.DataSources; -namespace SlidingWindowCache.Unit.Tests.Public.Cache; +namespace Intervals.NET.Caching.Unit.Tests.Public.Cache; /// /// Unit tests for WindowCache disposal behavior. diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Configuration/RuntimeOptionsSnapshotTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/RuntimeOptionsSnapshotTests.cs similarity index 96% rename from tests/SlidingWindowCache.Unit.Tests/Public/Configuration/RuntimeOptionsSnapshotTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/RuntimeOptionsSnapshotTests.cs index 659ad9c..f29227e 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Configuration/RuntimeOptionsSnapshotTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/RuntimeOptionsSnapshotTests.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching.Public.Configuration; -namespace SlidingWindowCache.Unit.Tests.Public.Configuration; +namespace Intervals.NET.Caching.Unit.Tests.Public.Configuration; /// /// Unit tests for that verify property initialization diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Configuration/RuntimeOptionsUpdateBuilderTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/RuntimeOptionsUpdateBuilderTests.cs similarity index 97% rename from tests/SlidingWindowCache.Unit.Tests/Public/Configuration/RuntimeOptionsUpdateBuilderTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/RuntimeOptionsUpdateBuilderTests.cs index 9bc1e19..786968e 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Configuration/RuntimeOptionsUpdateBuilderTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/RuntimeOptionsUpdateBuilderTests.cs @@ -1,7 +1,7 @@ -using SlidingWindowCache.Core.State; -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching.Core.State; +using Intervals.NET.Caching.Public.Configuration; -namespace SlidingWindowCache.Unit.Tests.Public.Configuration; +namespace Intervals.NET.Caching.Unit.Tests.Public.Configuration; /// /// Unit tests for verifying fluent API, diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Configuration/WindowCacheOptionsBuilderTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/WindowCacheOptionsBuilderTests.cs similarity index 99% rename from tests/SlidingWindowCache.Unit.Tests/Public/Configuration/WindowCacheOptionsBuilderTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/WindowCacheOptionsBuilderTests.cs index bb1105f..40e76ec 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Configuration/WindowCacheOptionsBuilderTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/WindowCacheOptionsBuilderTests.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching.Public.Configuration; -namespace SlidingWindowCache.Unit.Tests.Public.Configuration; +namespace Intervals.NET.Caching.Unit.Tests.Public.Configuration; /// /// Unit tests for that verify fluent API, diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Configuration/WindowCacheOptionsTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/WindowCacheOptionsTests.cs similarity index 99% rename from tests/SlidingWindowCache.Unit.Tests/Public/Configuration/WindowCacheOptionsTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/WindowCacheOptionsTests.cs index 45ed15a..5c0117a 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Configuration/WindowCacheOptionsTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Configuration/WindowCacheOptionsTests.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Public.Configuration; +using Intervals.NET.Caching.Public.Configuration; -namespace SlidingWindowCache.Unit.Tests.Public.Configuration; +namespace Intervals.NET.Caching.Unit.Tests.Public.Configuration; /// /// Unit tests for WindowCacheOptions that verify validation logic, property initialization, diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Extensions/WindowCacheConsistencyExtensionsTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Extensions/WindowCacheConsistencyExtensionsTests.cs similarity index 99% rename from tests/SlidingWindowCache.Unit.Tests/Public/Extensions/WindowCacheConsistencyExtensionsTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Extensions/WindowCacheConsistencyExtensionsTests.cs index 9b01fb5..4c9449e 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Extensions/WindowCacheConsistencyExtensionsTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Extensions/WindowCacheConsistencyExtensionsTests.cs @@ -1,10 +1,10 @@ using Intervals.NET.Domain.Default.Numeric; using Moq; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; -using SlidingWindowCache.Public.Extensions; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; +using Intervals.NET.Caching.Public.Extensions; -namespace SlidingWindowCache.Unit.Tests.Public.Extensions; +namespace Intervals.NET.Caching.Unit.Tests.Public.Extensions; /// /// Unit tests for diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/FuncDataSourceTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/FuncDataSourceTests.cs similarity index 98% rename from tests/SlidingWindowCache.Unit.Tests/Public/FuncDataSourceTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/FuncDataSourceTests.cs index 8f08f12..ab5d46a 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/FuncDataSourceTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/FuncDataSourceTests.cs @@ -1,8 +1,8 @@ using Intervals.NET; -using SlidingWindowCache.Public; -using SlidingWindowCache.Public.Dto; +using Intervals.NET.Caching.Public; +using Intervals.NET.Caching.Public.Dto; -namespace SlidingWindowCache.Unit.Tests.Public; +namespace Intervals.NET.Caching.Unit.Tests.Public; /// /// Unit tests for . diff --git a/tests/SlidingWindowCache.Unit.Tests/Public/Instrumentation/NoOpDiagnosticsTests.cs b/tests/Intervals.NET.Caching.Unit.Tests/Public/Instrumentation/NoOpDiagnosticsTests.cs similarity index 92% rename from tests/SlidingWindowCache.Unit.Tests/Public/Instrumentation/NoOpDiagnosticsTests.cs rename to tests/Intervals.NET.Caching.Unit.Tests/Public/Instrumentation/NoOpDiagnosticsTests.cs index aa410c7..25604b3 100644 --- a/tests/SlidingWindowCache.Unit.Tests/Public/Instrumentation/NoOpDiagnosticsTests.cs +++ b/tests/Intervals.NET.Caching.Unit.Tests/Public/Instrumentation/NoOpDiagnosticsTests.cs @@ -1,6 +1,6 @@ -using SlidingWindowCache.Public.Instrumentation; +using Intervals.NET.Caching.Public.Instrumentation; -namespace SlidingWindowCache.Unit.Tests.Public.Instrumentation; +namespace Intervals.NET.Caching.Unit.Tests.Public.Instrumentation; /// /// Unit tests for NoOpDiagnostics to ensure it never throws exceptions.