-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-add FusioCacheChaosUtils (with the typo) as a forwarder to the new…
… correct one, with Obsolete attributes to warn the users
- Loading branch information
1 parent
5fa91b5
commit dbf9dba
Showing
2 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
104 changes: 104 additions & 0 deletions
104
src/ZiggyCreatures.FusionCache.Chaos/FusioCacheChaosUtils.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Threading.Tasks; | ||
|
||
namespace ZiggyCreatures.Caching.Fusion.Chaos | ||
{ | ||
/// <summary> | ||
/// Various utils to work with randomized controllable chaos. | ||
/// </summary> | ||
[Obsolete("Please use Fusio(n)CacheChaosUtils class and methods (the method names are the same), there was a typo in the class name (sorry)", true)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static class FusioCacheChaosUtils | ||
{ | ||
/// <summary> | ||
/// Determines if an exception should be thrown. | ||
/// </summary> | ||
/// <param name="throwProbability">The probabilty that an exception will be thrown.</param> | ||
/// <returns><see langword="true"/> if an exception should be thrown, <see langword="false"/> otherwise.</returns> | ||
[Obsolete("Please use Fusio(n)CacheChaosUtils class and methods (the method names are the same), there was a typo in the class name (sorry)", true)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static bool ShouldCreateChaos(float throwProbability) | ||
{ | ||
return FusionCacheChaosUtils.ShouldCreateChaos(throwProbability); | ||
} | ||
|
||
/// <summary> | ||
/// Maybe throw a <see cref="ChaosException"/> based on the specified probabilty. | ||
/// </summary> | ||
/// <param name="throwProbability">The probabilty that an exception will be thrown.</param> | ||
[Obsolete("Please use Fusio(n)CacheChaosUtils class and methods (the method names are the same), there was a typo in the class name (sorry)", true)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static void MaybeThrow(float throwProbability) | ||
{ | ||
FusionCacheChaosUtils.MaybeThrow(throwProbability); | ||
} | ||
|
||
/// <summary> | ||
/// Randomize an actual delay with a value between <paramref name="minDelay"/> and <paramref name="maxDelay"/>. | ||
/// </summary> | ||
/// <param name="minDelay">The minimun amount of delay.</param> | ||
/// <param name="maxDelay">The maximum amount of delay.</param> | ||
/// <returns>The randomized delay.</returns> | ||
[Obsolete("Please use Fusio(n)CacheChaosUtils class and methods (the method names are the same), there was a typo in the class name (sorry)", true)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static TimeSpan RandomizeDelay(TimeSpan minDelay, TimeSpan maxDelay) | ||
{ | ||
return FusionCacheChaosUtils.RandomizeDelay(minDelay, maxDelay); | ||
} | ||
|
||
/// <summary> | ||
/// Randomize an actual delay with a value between <paramref name="minDelay"/> and <paramref name="maxDelay"/>, and waits for it. | ||
/// </summary> | ||
/// <param name="minDelay">The minimun amount of delay.</param> | ||
/// <param name="maxDelay">The maximum amount of delay.</param> | ||
[Obsolete("Please use Fusio(n)CacheChaosUtils class and methods (the method names are the same), there was a typo in the class name (sorry)", true)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static void MaybeDelay(TimeSpan minDelay, TimeSpan maxDelay) | ||
{ | ||
FusionCacheChaosUtils.MaybeDelay(minDelay, maxDelay); | ||
} | ||
|
||
/// <summary> | ||
/// Randomize an actual delay with a value between <paramref name="minDelay"/> and <paramref name="maxDelay"/>, and waits for it. | ||
/// </summary> | ||
/// <param name="minDelay">The minimun amount of delay.</param> | ||
/// <param name="maxDelay">The maximum amount of delay.</param> | ||
/// <returns>A <see cref="Task"/> instance to await.</returns> | ||
[Obsolete("Please use Fusio(n)CacheChaosUtils class and methods (the method names are the same), there was a typo in the class name (sorry)", true)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static Task MaybeDelayAsync(TimeSpan minDelay, TimeSpan maxDelay) | ||
{ | ||
return FusionCacheChaosUtils.MaybeDelayAsync(minDelay, maxDelay); | ||
} | ||
|
||
/// <summary> | ||
/// Randomize an actual delay with a value between <paramref name="minDelay"/> and <paramref name="maxDelay"/>, and waits for it. | ||
/// Then, maybe, throw a <see cref="ChaosException"/> based on the specified probabilty. | ||
/// </summary> | ||
/// <param name="throwProbability">The probabilty that an exception will be thrown.</param> | ||
/// <param name="minDelay">The minimun amount of delay.</param> | ||
/// <param name="maxDelay">The maximum amount of delay.</param> | ||
[Obsolete("Please use Fusio(n)CacheChaosUtils class and methods (the method names are the same), there was a typo in the class name (sorry)", true)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static void MaybeChaos(TimeSpan minDelay, TimeSpan maxDelay, float throwProbability) | ||
{ | ||
FusionCacheChaosUtils.MaybeChaos(minDelay, maxDelay, throwProbability); | ||
} | ||
|
||
/// <summary> | ||
/// Randomize an actual delay with a value between <paramref name="minDelay"/> and <paramref name="maxDelay"/>, and waits for it. | ||
/// Then, maybe, throw a <see cref="ChaosException"/> based on the specified probabilty. | ||
/// </summary> | ||
/// <param name="throwProbability">The probabilty that an exception will be thrown.</param> | ||
/// <param name="minDelay">The minimun amount of delay.</param> | ||
/// <param name="maxDelay">The maximum amount of delay.</param> | ||
/// <returns>A <see cref="Task"/> instance to await.</returns> | ||
[Obsolete("Please use Fusio(n)CacheChaosUtils class and methods (the method names are the same), there was a typo in the class name (sorry)", true)] | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
public static Task MaybeChaosAsync(TimeSpan minDelay, TimeSpan maxDelay, float throwProbability) | ||
{ | ||
return FusionCacheChaosUtils.MaybeChaosAsync(minDelay, maxDelay, throwProbability); | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
src/ZiggyCreatures.FusionCache.Chaos/ZiggyCreatures.FusionCache.Chaos.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.