GMap.NET.Core/GMap.NET.Internals/KiberTileCache.cs
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace GMap.NET.Internals
{
using System.Collections.Generic;
using System.IO;
using System;
/// <summary>
/// kiber speed memory cache for tiles with history support ;}
/// </summary>
internal class KiberTileCache : Dictionary<RawTile, byte[]>
{
readonly Queue<RawTile> Queue = new Queue<RawTile>();
/// <summary>
/// the amount of tiles in MB to keep in memmory, default: 22MB, if each ~100Kb it's ~222 tiles
/// </summary>
#if !PocketPC
public int MemoryCacheCapacity = 22;
#else
public int MemoryCacheCapacity = 3;
#endif
long memoryCacheSize = 0;
/// <summary>
/// current memmory cache size in MB
/// </summary>
public double MemoryCacheSize
{
get
{
return memoryCacheSize / 1048576.0;
}
}
public new void Add(RawTile key, byte[] value)
{
Queue.Enqueue(key);
base.Add(key, value);
memoryCacheSize += value.Length;
}
// do not allow directly removal of elements
private new void Remove(RawTile key)
{
}
public new void Clear()
{
Queue.Clear();
base.Clear();
}
internal void RemoveMemoryOverload()
{
while(MemoryCacheSize > MemoryCacheCapacity)
{
后面还有 24 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
