ICache

Description

interface Tinman.Core.Caching.ICache<TId>

Derived from

ICacheBase<TId>

Extended by

LruCache sealed

Base interface for cache-like data structures with extended functionality.

This interface is based on ICacheBase, and provides additional features:

Public / Methods

Fetch


public method Fetch → (3)

pageId in : TId

The page ID.

loadFlags in : PageLoadFlags

The flags that determine how to load the cache page. When set to PageLoadFlags.Manual, cache page loading will not be performed. The calling code must load the cache page in this case.

keepLocked in : bool

Keep the cache page in locked state after fetching it (see LockPage)?

returns → int32
  • >= 0:
    The page is present in the cache, the return value is its index.

  • = Maths.MinInt:
    If all cache pages are locked.

  • <= -1:
    The page is not present in the cache and shall be loaded into the cache using the page index given by -1-return.

Fetches a page from the cache, loading it if necessary.

When this method returns, all necessary calls to ICacheCallback.CachePageChoose and ICacheCallback.CachePageData will have been done.

IsPageLocked


public method IsPageLocked → (1)

pageIndex in : int32

[0..ICacheBase.Capacity-1]
Index of page to unlock.

returns → bool

true if the cache page is locked, false if not.

Is the given cache page locked?

IsPartial


public method IsPartial → (1)

pageIndex in : int32

[0..ICacheBase.Capacity-1]
The page index.

returns → bool

true if the given page has been loaded partially, false if the page is either fully loaded or non-existent.

Has the given page been partially loaded?

LockPage


public method LockPage → (1)

pageIndex in : int32

[0..ICacheBase.Capacity-1]
Index of page to lock.

Locks a cache page so that it will not be evicted from the cache by future calls.

UnlockPage


public method UnlockPage → (1)

pageIndex in : int32

[0..ICacheBase.Capacity-1]
Index of page to unlock.

Unlocks a previously locked cache page.

See also

ICache.LockPage