Skip to content

Commit 09680de

Browse files
author
Alex Peck
committed
fix bench
1 parent e601feb commit 09680de

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

BitFaster.Caching.Benchmarks/BitFaster.Caching.Benchmarks.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFrameworks>net48;net6.0;net8.0</TargetFrameworks>
6+
<LangVersion>10.0</LangVersion>
67
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
78
<!-- https://stackoverflow.com/a/59916801/131345 -->
89
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>

BitFaster.Caching.Benchmarks/Lru/LruJustGetOrAdd.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ Microsoft.Extensions.Caching.Memory.MemoryCache exMemoryCache
6666
[GlobalSetup]
6767
public void GlobalSetup()
6868
{
69-
memoryCache.Set(key.ToString(), "test", new System.Runtime.Caching.CacheItemPolicy());
70-
exMemoryCache.Set(key, "test");
69+
memoryCache.Set(key.ToString(), "1", new System.Runtime.Caching.CacheItemPolicy());
70+
exMemoryCache.Set(key, "1");
7171
}
7272

7373
[GlobalCleanup]
@@ -147,15 +147,15 @@ public int ClassicLru()
147147
}
148148

149149
[Benchmark()]
150-
public int RuntimeMemoryCacheGet()
150+
public object RuntimeMemoryCacheGet()
151151
{
152-
return (int)memoryCache.Get("1");
152+
return memoryCache.Get("1");
153153
}
154154

155155
[Benchmark()]
156-
public int ExtensionsMemoryCacheGet()
156+
public object ExtensionsMemoryCacheGet()
157157
{
158-
return (int)exMemoryCache.Get(1);
158+
return exMemoryCache.Get(1);
159159
}
160160

161161
public class MemoryCacheOptionsAccessor

0 commit comments

Comments
 (0)