Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ZiggyCreatures.FusionCache.Chaos/FusionCacheChaosUtils.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ZiggyCreatures.Caching.Fusion.Internals;
using ThreadSafeRandomizer;

namespace ZiggyCreatures.Caching.Fusion.Chaos;

Expand All @@ -20,7 +20,7 @@ public static bool ShouldThrow(float throwProbability)
if (throwProbability >= 1f)
return true;

return ConcurrentRandom.NextDouble() < throwProbability;
return ThreadSafeRandom.Instance.NextDouble() < throwProbability;
}

/// <summary>
Expand All @@ -47,7 +47,7 @@ public static TimeSpan GetRandomDelay(TimeSpan minDelay, TimeSpan maxDelay)
if (minDelay >= maxDelay)
return minDelay;

return minDelay + TimeSpan.FromMilliseconds(ConcurrentRandom.NextDouble() * (maxDelay - minDelay).TotalMilliseconds);
return minDelay + TimeSpan.FromMilliseconds(ThreadSafeRandom.Instance.NextDouble() * (maxDelay - minDelay).TotalMilliseconds);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.0;net6.0</TargetFramework>
<Version>2.5.0</Version>
<PackageId>ZiggyCreatures.FusionCache.Chaos</PackageId>
<Description>Chaos-related utilities and implementations of various componenets (like a distributed cache or a backplane), useful for things like testing dependent components' behavior in a controlled failing environment.</Description>
Expand Down
3 changes: 2 additions & 1 deletion src/ZiggyCreatures.FusionCache/FusionCacheEntryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.Logging;
using ThreadSafeRandomizer;
using ZiggyCreatures.Caching.Fusion.Events;
using ZiggyCreatures.Caching.Fusion.Internals;
using ZiggyCreatures.Caching.Fusion.Internals.Memory;
Expand Down Expand Up @@ -527,7 +528,7 @@ public double GetJitterDurationMs()
if (JitterMaxDuration <= TimeSpan.Zero)
return 0d;

return ConcurrentRandom.NextDouble() * JitterMaxDuration.TotalMilliseconds;
return ThreadSafeRandom.Instance.NextDouble() * JitterMaxDuration.TotalMilliseconds;
}

/// <summary>
Expand Down
91 changes: 0 additions & 91 deletions src/ZiggyCreatures.FusionCache/Internals/ConcurrentRandom.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net8.0;net9.0</TargetFrameworks>
<Version>2.5.0</Version>
<PackageId>ZiggyCreatures.FusionCache</PackageId>
<Description>FusionCache is an easy to use, fast and robust hybrid cache with advanced resiliency features.</Description>
Expand Down Expand Up @@ -31,6 +31,10 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.1" />
<PackageReference Include="ThreadSafeRandomizer" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
Expand All @@ -41,6 +45,7 @@

<ItemGroup>
<InternalsVisibleTo Include="ZiggyCreatures.FusionCache.Benchmarks" />
<InternalsVisibleTo Include="ZiggyCreatures.FusionCache.Chaos" />
<InternalsVisibleTo Include="ZiggyCreatures.FusionCache.Tests" />
</ItemGroup>

Expand Down
Loading