Skip to content

Commit

Permalink
Bump PolySharp from 1.10.0 to 1.11.0 (#33)
Browse files Browse the repository at this point in the history
* Bump PolySharp from 1.10.0 to 1.11.0

Bumps [PolySharp](https://github.com/Sergio0694/PolySharp) from 1.10.0 to 1.11.0.
- [Release notes](https://github.com/Sergio0694/PolySharp/releases)
- [Commits](Sergio0694/PolySharp@1.10.0...1.11.0)

---
updated-dependencies:
- dependency-name: PolySharp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Another commit on trying to stabilize tests that verify expiration because of test runner side effects

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: neon-sunset <20912188+neon-sunset@users.noreply.github.com>
  • Loading branch information
dependabot[bot] and neon-sunset committed Jan 20, 2023
1 parent 91445f5 commit 68f0f37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PolySharp" Version="1.10.0">
<PackageReference Include="PolySharp" Version="1.11.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
10 changes: 7 additions & 3 deletions tests/FastCache.CachedTests/Cached_ExpirationPermutations.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Runtime.CompilerServices;
using FastCache.Extensions;

namespace FastCache.CachedTests;
Expand All @@ -10,21 +11,24 @@ public sealed class CachedTests_ExpirationPermutations
[InlineData(500)]
[InlineData(1000)]
[InlineData(2500)]
[MethodImpl(0x200)]
public async Task Cached_TryGet_ReturnsValueBeforeExpiration_DoesNotReturnAfter(int milliseconds)
{
const int delayTolerance = 100;
const int delayTolerance = 200;

var assertDelay = Math.Max(0, milliseconds - delayTolerance);

var key = GetTestKey(milliseconds);
var value = GetRandomString();
value.Cache(key, TimeSpan.FromMilliseconds(milliseconds));

await Task.Delay(Math.Max(0, milliseconds - delayTolerance));
await Task.Delay(assertDelay);
var foundBefore = Cached<string>.TryGet(key, out var cachedBefore);

Assert.True(foundBefore);
Assert.Equal(value, cachedBefore);

await Task.Delay(delayTolerance + 1);
await Task.Delay(milliseconds - assertDelay + 1);
var foundAfter = Cached<string>.TryGet(key, out _);

Assert.False(foundAfter);
Expand Down

0 comments on commit 68f0f37

Please sign in to comment.