public void AddOrUpdate(string key, Token token) { if (!_cached.ContainsKey(key)) { _cached.TryAdd(key, token); _cleaner.RegistPriority(key); } else { //_cleaner.UpdatePriority(key); } }
public void AddContext(string key, out PagePointer ptr) { if (!_header.TryGetPointer(key, out ptr)) { throw new KeyNotFoundException($"not found key in header: {key}"); } _cachedCtx.Add(key, new Context { pageIndex = ptr.index, key = key, offset = ptr.offset, count = ptr.size, }); _cleaner.RegistPriority(key); _increaseRef(ptr.index); }