You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Goal: Integrate ASP.NET Core Output Caching into the xSDK framework, leveraging the internal VariableService for dynamic, configuration-driven policy management.
Task 1: Define the OutputCacheSettings POCO class within the xSDK namespace to map VariableService configuration keys (e.g., xsdk:cache:output).
Task 2: Implement a VariableService binder to hydrate OutputCacheOptions from the centralized configuration store during the AddXSdk() startup sequence.
Task 3: Create a ServiceCollection extension that registers AddOutputCache() only if VariableService.Get<bool>("Cache:Output:Enabled") returns true.
Task 4: Develop a PolicyFactory that iterates through VariableService lists to dynamically register named policies (e.g., Default, ShortLived, NoAuth).
Task 5: Implement a custom IOutputCachePolicy that respects xSDK-specific headers or tenant IDs retrieved via the VariableService environment context.
Task 6: Hook into the IApplicationBuilder pipeline to inject UseOutputCache() at the technically correct position (after Routing, before Auth/Endpoints).
Task 7: Add a VariableService watcher or reload token integration to allow updating cache durations without restarting the application.
Task 8: Create an internal xSDK attribute [XSdkOutputCache(PolicyName)] that acts as a wrapper to provide better IntelliSense and framework-specific defaults.
🔍 Acceptance Criteria
Output Caching is togglable via VariableService at runtime or startup.
Named policies defined in the VariableService JSON/Environment are correctly registered in the DI container.
The middleware order ensures that xSDK's internal VariableService updates are processed before cache lookup if necessary.
Technical validation: Responses are cached according to the expiration values defined in the Variable store.
⚠️ Constraints & Out-of-Scope
Dependency: Must rely strictly on the xSdk.Extensions.Variable pattern for configuration, avoiding direct IConfiguration access where possible.
Scope: Initial implementation focuses on the In-Memory provider. Distributed stores (Redis) are deferred to a separate Epic.
💡 AI-Suggestions
Dynamic Tags: Use VariableService to define "Invalidation Groups" so that changing a single variable value can trigger a BasePolicy cache eviction.
Telemetry: Integrate ILogger within the policy execution to track Cache Hits/Misses specifically for xSDK-managed endpoints.
Configurable Output Caching via VariableService
🎯 Summary
VariableServicefor dynamic, configuration-driven policy management.Microsoft.AspNetCore.OutputCaching,xSdk.Extensions.Variable,.NET 10.0,IConfiguration🛠 Roadmap (Pomodoro Tasks)
OutputCacheSettingsPOCO class within the xSDK namespace to mapVariableServiceconfiguration keys (e.g.,xsdk:cache:output).VariableServicebinder to hydrateOutputCacheOptionsfrom the centralized configuration store during theAddXSdk()startup sequence.ServiceCollectionextension that registersAddOutputCache()only ifVariableService.Get<bool>("Cache:Output:Enabled")returns true.PolicyFactorythat iterates throughVariableServicelists to dynamically register named policies (e.g.,Default,ShortLived,NoAuth).IOutputCachePolicythat respects xSDK-specific headers or tenant IDs retrieved via theVariableServiceenvironment context.IApplicationBuilderpipeline to injectUseOutputCache()at the technically correct position (after Routing, before Auth/Endpoints).VariableServicewatcher or reload token integration to allow updating cache durations without restarting the application.[XSdkOutputCache(PolicyName)]that acts as a wrapper to provide better IntelliSense and framework-specific defaults.🔍 Acceptance Criteria
VariableServiceat runtime or startup.VariableServiceJSON/Environment are correctly registered in the DI container.VariableServiceupdates are processed before cache lookup if necessary.Variablestore.xSdk.Extensions.Variablepattern for configuration, avoiding directIConfigurationaccess where possible.In-Memoryprovider. Distributed stores (Redis) are deferred to a separate Epic.💡 AI-Suggestions
VariableServiceto define "Invalidation Groups" so that changing a single variable value can trigger aBasePolicycache eviction.ILoggerwithin the policy execution to track Cache Hits/Misses specifically for xSDK-managed endpoints.📚 Resources