diff --git a/Directory.Build.props b/Directory.Build.props index d3815c3e2..3225a2103 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 11.0.0-beta.65+8.0.303 + 11.0.0-beta.66+8.0.303 Steven T. Cramer TimeWarp State $(TimeWarpStateVersion) diff --git a/Source/TimeWarp.State.Plus/State/ICacheableState.cs b/Source/TimeWarp.State.Plus/State/ITimeWarpCacheableState.cs similarity index 76% rename from Source/TimeWarp.State.Plus/State/ICacheableState.cs rename to Source/TimeWarp.State.Plus/State/ITimeWarpCacheableState.cs index 27913e09f..a2b4155f7 100644 --- a/Source/TimeWarp.State.Plus/State/ICacheableState.cs +++ b/Source/TimeWarp.State.Plus/State/ITimeWarpCacheableState.cs @@ -1,6 +1,6 @@ namespace TimeWarp.State.Plus.State; -public interface ICacheableState +public interface ITimeWarpCacheableState { string? CacheKey { get; } DateTime? TimeStamp { get; } diff --git a/Source/TimeWarp.State.Plus/State/BaseCacheableState.cs b/Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs similarity index 90% rename from Source/TimeWarp.State.Plus/State/BaseCacheableState.cs rename to Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs index 7be7557fd..acbe58359 100644 --- a/Source/TimeWarp.State.Plus/State/BaseCacheableState.cs +++ b/Source/TimeWarp.State.Plus/State/TimeWarpCacheableState.cs @@ -1,15 +1,11 @@ namespace TimeWarp.State.Plus.State; -public abstract class BaseCacheableState : State, ICacheableState +public abstract class TimeWarpCacheableState : State, ITimeWarpCacheableState +where TState : IState { public string? CacheKey { get; private set; } public DateTime? TimeStamp { get; private set; } - public TimeSpan CacheDuration { get; private set; } - - protected BaseCacheableState(TimeSpan cacheDuration) - { - CacheDuration = cacheDuration; - } + public TimeSpan CacheDuration { get; protected set; } /// /// Checks if the cache is valid based on the current cache key and timestamp diff --git a/Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs b/Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs index 329c63eb3..a95cb21bb 100644 --- a/Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs +++ b/Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs @@ -3,13 +3,16 @@ namespace Test.App.Client.Features.WeatherForecast; using TimeWarp.State.Plus.State; using static Contracts.Features.WeatherForecast.GetWeatherForecasts; -internal partial class CacheableWeatherState: BaseCacheableState +internal partial class CacheableWeatherState: TimeWarpCacheableState { private Response? WeatherForecastList; public IReadOnlyList? WeatherForecasts => WeatherForecastList?.AsReadOnly(); - public CacheableWeatherState():base(TimeSpan.FromSeconds(10)) {} // Set this to short duration for testing + public CacheableWeatherState() + { + CacheDuration = TimeSpan.FromSeconds(10); + } // Set this to short duration for testing /// public override void Initialize()