New to Telerik UI for WinForms? Start a free 30-day trial

Stores map cache entries in memory for the lifetime of the provider instance; entries are not persisted to disk.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.RadMap.dll

Syntax:

C#
public class MemoryCacheProvider : IMapCacheProvider

Inheritance: objectMemoryCacheProvider

Implements: IMapCacheProvider

Constructors

Initializes an empty in-memory cache.

C#
public MemoryCacheProvider()

Fields

cache

Dictionary<string, byte[]>

Stores cached byte content by key. Changes made directly to this dictionary affect subsequent cache lookups.

C#
public Dictionary<string, byte[]> cache

Methods

Returns the cached content for a key as a stream, or null if the key is not present.

C#
public Stream Load(string key)
Parameters:keystring

The cache key to look up.

Returns:

Stream

A stream over the cached bytes, or null when the key is absent.

Implements: IMapCacheProvider.Load(string)

Invokes the callback synchronously with the cached content, or with null for a cache miss.

C#
public void LoadAsync(string key, Action<string, byte[]> callback)
Parameters:keystring

The cache key to look up.

callbackAction<string, byte[]>

Receives the key and its cached bytes, or null when the key is absent.

Implements: IMapCacheProvider.LoadAsync(string, Action<string, byte[]>)

Adds or replaces the cached bytes for a key. This implementation does not enforce the expiration date.

C#
public void Save(string key, DateTime expirationDate, byte[] content)
Parameters:keystring

The cache key to store.

expirationDateDateTime

Not used by this in-memory cache implementation.

contentbyte[]

The bytes to associate with the key.

Implements: IMapCacheProvider.Save(string, DateTime, byte[])