本文整理汇总了C#中BTDB.KVDBLayer.InMemoryFileCollection.Enumerate方法的典型用法代码示例。如果您正苦于以下问题:C# InMemoryFileCollection.Enumerate方法的具体用法?C# InMemoryFileCollection.Enumerate怎么用?C# InMemoryFileCollection.Enumerate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BTDB.KVDBLayer.InMemoryFileCollection
的用法示例。
在下文中一共展示了InMemoryFileCollection.Enumerate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GettingContentMakesItStayLongerDecreasingRate
public void GettingContentMakesItStayLongerDecreasingRate()
{
using (var fileCollection = new InMemoryFileCollection())
{
const int cacheCapacity = 50000;
using (var cache = new DiskChunkCache(fileCollection, 20, cacheCapacity))
{
for (var i = 0; i < 80; i++)
{
Put(cache, i);
for (var j = 0; j < 79 - i; j++)
Get(cache, i);
Assert.LessOrEqual(fileCollection.Enumerate().Sum(f => (long)f.GetSize()), cacheCapacity);
}
Console.WriteLine(cache.CalcStats());
Assert.True(Get(cache, 0));
Assert.False(Get(cache, 60));
}
}
}
示例2: AccessEveryTenthTenTimesMoreMakesItStay
public void AccessEveryTenthTenTimesMoreMakesItStay()
{
using (var fileCollection = new InMemoryFileCollection())
{
const int cacheCapacity = 50000;
using (var cache = new DiskChunkCache(fileCollection, 20, cacheCapacity))
{
for (var i = 0; i < 46; i++)
{
Put(cache, i);
for (var j = 0; j < (i % 5 == 0 ? 10 + i : 1); j++)
Get(cache, i);
if (i==42) Thread.Sleep(500);
Assert.LessOrEqual(fileCollection.Enumerate().Sum(f => (long)f.GetSize()), cacheCapacity);
}
Console.WriteLine(cache.CalcStats());
Assert.True(Get(cache, 0));
Assert.False(Get(cache, 1));
}
}
}
示例3: SizeDoesNotGrowOverLimit
public void SizeDoesNotGrowOverLimit()
{
using (var fileCollection = new InMemoryFileCollection())
{
const int cacheCapacity = 50000;
using (var cache = new DiskChunkCache(fileCollection, 20, cacheCapacity))
{
for (var i = 0; i < 80; i++)
{
Put(cache, i);
Assert.LessOrEqual(fileCollection.Enumerate().Sum(f => (long)f.GetSize()), cacheCapacity);
}
}
}
}