Skip to content

Commit

Permalink
Merge pull request #450 from TimeWarpEngineering/Cramer/2024-07-24/Next
Browse files Browse the repository at this point in the history
Rename BaseCacheableState to TimeWarpCacheableState
  • Loading branch information
StevenTCramer authored Jul 24, 2024
2 parents 2e8cedd + 38777c4 commit 2702de9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<!-- Set common properties regarding assembly information and nuget packages -->
<PropertyGroup>
<TimeWarpStateVersion>11.0.0-beta.65+8.0.303</TimeWarpStateVersion>
<TimeWarpStateVersion>11.0.0-beta.66+8.0.303</TimeWarpStateVersion>
<Authors>Steven T. Cramer</Authors>
<Product>TimeWarp State</Product>
<PackageVersion>$(TimeWarpStateVersion)</PackageVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace TimeWarp.State.Plus.State;

public interface ICacheableState
public interface ITimeWarpCacheableState
{
string? CacheKey { get; }
DateTime? TimeStamp { get; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
namespace TimeWarp.State.Plus.State;

public abstract class BaseCacheableState<TState> : State<TState>, ICacheableState
public abstract class TimeWarpCacheableState<TState> : State<TState>, 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; }

/// <summary>
/// Checks if the cache is valid based on the current cache key and timestamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ namespace Test.App.Client.Features.WeatherForecast;
using TimeWarp.State.Plus.State;

Check warning on line 3 in Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Redundant using directive

Using directive is not required by the code and can be safely removed
using static Contracts.Features.WeatherForecast.GetWeatherForecasts;

internal partial class CacheableWeatherState: BaseCacheableState<CacheableWeatherState>
internal partial class CacheableWeatherState: TimeWarpCacheableState<CacheableWeatherState>
{
private Response? WeatherForecastList;

public IReadOnlyList<WeatherForecastDto>? 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

///<inheritdoc/>

Check warning on line 17 in Tests/Test.App/Test.App.Client/Features/CacheableWeather/CacheableWeatherState.cs

View workflow job for this annotation

GitHub Actions / Qodana for .NET

Usage of <inheritdoc /> is invalid

Usage of is invalid: No base candidate to inherit from
public override void Initialize()
Expand Down

0 comments on commit 2702de9

Please sign in to comment.