Skip to content

Commit b4878fe

Browse files
committed
Uncomment tests
1 parent a71aa22 commit b4878fe

1 file changed

Lines changed: 93 additions & 93 deletions

File tree

benchmarks/CacheTower.Benchmarks/CacheStackBenchmark.cs

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -31,100 +31,100 @@ public ConfigSettings()
3131
}
3232
}
3333

34-
//[Benchmark]
35-
//public async Task Set()
36-
//{
37-
// await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
38-
// {
39-
// for (var i = 0; i < WorkIterations; i++)
40-
// {
41-
// await cacheStack.SetAsync("Set", 15, TimeSpan.FromDays(1));
42-
// }
43-
// }
44-
//}
45-
//[Benchmark]
46-
//public async Task Set_TwoLayers()
47-
//{
48-
// await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer(), new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
49-
// {
50-
// for (var i = 0; i < WorkIterations; i++)
51-
// {
52-
// await cacheStack.SetAsync("Set", 15, TimeSpan.FromDays(1));
53-
// }
54-
// }
55-
//}
56-
//[Benchmark]
57-
//public async Task Evict()
58-
//{
59-
// await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
60-
// {
61-
// for (var i = 0; i < WorkIterations; i++)
62-
// {
63-
// await cacheStack.SetAsync("Evict", 15, TimeSpan.FromDays(1));
64-
// await cacheStack.EvictAsync("Evict");
65-
// }
66-
// }
67-
//}
68-
//[Benchmark]
69-
//public async Task Evict_TwoLayers()
70-
//{
71-
// await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer(), new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
72-
// {
73-
// for (var i = 0; i < WorkIterations; i++)
74-
// {
75-
// await cacheStack.SetAsync("Evict", 15, TimeSpan.FromDays(1));
76-
// await cacheStack.EvictAsync("Evict");
77-
// }
78-
// }
79-
//}
80-
//[Benchmark]
81-
//public async Task Cleanup()
82-
//{
83-
// await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
84-
// {
85-
// for (var i = 0; i < WorkIterations; i++)
86-
// {
87-
// await cacheStack.SetAsync("Cleanup", 15, TimeSpan.FromDays(1));
88-
// await cacheStack.CleanupAsync();
89-
// }
90-
// }
91-
//}
92-
//[Benchmark]
93-
//public async Task Cleanup_TwoLayers()
94-
//{
95-
// await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer(), new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
96-
// {
97-
// for (var i = 0; i < WorkIterations; i++)
98-
// {
99-
// await cacheStack.SetAsync("Cleanup", 15, TimeSpan.FromDays(1));
100-
// await cacheStack.CleanupAsync();
101-
// }
102-
// }
103-
//}
104-
//[Benchmark]
105-
//public async Task GetMiss()
106-
//{
107-
// await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
108-
// {
109-
// for (var i = 0; i < WorkIterations; i++)
110-
// {
111-
// await cacheStack.GetAsync<int>("GetMiss");
112-
// }
113-
// }
114-
//}
115-
//[Benchmark]
116-
//public async Task GetHit()
117-
//{
118-
// await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
119-
// {
120-
// await cacheStack.SetAsync("GetHit", 15, TimeSpan.FromDays(1));
34+
[Benchmark]
35+
public async Task Set()
36+
{
37+
await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
38+
{
39+
for (var i = 0; i < WorkIterations; i++)
40+
{
41+
await cacheStack.SetAsync("Set", 15, TimeSpan.FromDays(1));
42+
}
43+
}
44+
}
45+
[Benchmark]
46+
public async Task Set_TwoLayers()
47+
{
48+
await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer(), new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
49+
{
50+
for (var i = 0; i < WorkIterations; i++)
51+
{
52+
await cacheStack.SetAsync("Set", 15, TimeSpan.FromDays(1));
53+
}
54+
}
55+
}
56+
[Benchmark]
57+
public async Task Evict()
58+
{
59+
await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
60+
{
61+
for (var i = 0; i < WorkIterations; i++)
62+
{
63+
await cacheStack.SetAsync("Evict", 15, TimeSpan.FromDays(1));
64+
await cacheStack.EvictAsync("Evict");
65+
}
66+
}
67+
}
68+
[Benchmark]
69+
public async Task Evict_TwoLayers()
70+
{
71+
await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer(), new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
72+
{
73+
for (var i = 0; i < WorkIterations; i++)
74+
{
75+
await cacheStack.SetAsync("Evict", 15, TimeSpan.FromDays(1));
76+
await cacheStack.EvictAsync("Evict");
77+
}
78+
}
79+
}
80+
[Benchmark]
81+
public async Task Cleanup()
82+
{
83+
await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
84+
{
85+
for (var i = 0; i < WorkIterations; i++)
86+
{
87+
await cacheStack.SetAsync("Cleanup", 15, TimeSpan.FromDays(1));
88+
await cacheStack.CleanupAsync();
89+
}
90+
}
91+
}
92+
[Benchmark]
93+
public async Task Cleanup_TwoLayers()
94+
{
95+
await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer(), new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
96+
{
97+
for (var i = 0; i < WorkIterations; i++)
98+
{
99+
await cacheStack.SetAsync("Cleanup", 15, TimeSpan.FromDays(1));
100+
await cacheStack.CleanupAsync();
101+
}
102+
}
103+
}
104+
[Benchmark]
105+
public async Task GetMiss()
106+
{
107+
await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
108+
{
109+
for (var i = 0; i < WorkIterations; i++)
110+
{
111+
await cacheStack.GetAsync<int>("GetMiss");
112+
}
113+
}
114+
}
115+
[Benchmark]
116+
public async Task GetHit()
117+
{
118+
await using (var cacheStack = new CacheStack(new[] { new MemoryCacheLayer() }, Array.Empty<ICacheExtension>()))
119+
{
120+
await cacheStack.SetAsync("GetHit", 15, TimeSpan.FromDays(1));
121121

122-
// for (var i = 0; i < WorkIterations; i++)
123-
// {
124-
// await cacheStack.GetAsync<int>("GetHit");
125-
// }
126-
// }
127-
//}
122+
for (var i = 0; i < WorkIterations; i++)
123+
{
124+
await cacheStack.GetAsync<int>("GetHit");
125+
}
126+
}
127+
}
128128
[Benchmark]
129129
public async Task GetOrSet_NeverStale()
130130
{

0 commit comments

Comments
 (0)