Nebula
SharedCache

ISharedCacheStore

Where the shared cache keeps its objects: a folder (FolderSharedCacheStore), the orchestrator's database (SqlSharedCacheStore in the standalone orchestrator), or memory (MemorySharedCacheStore).

generated from the sources
public interface ISharedCacheStore : IDisposable

Where the shared cache keeps its objects: a folder (FolderSharedCacheStore), the orchestrator's database (SqlSharedCacheStore in the standalone orchestrator), or memory (MemorySharedCacheStore).

A store is write-once: Put never replaces an object that is already there, because a key names its content. Every method is synchronous, safe to call from any thread and may block on disk or the network, so call it from a worker thread, never from a tick. A store throws when its backend fails; the caller (SharedCacheHost or a client) turns that into a miss or a refused write.

Properties

Backend

string Backend { get; }

"folder", "memory", "sqlite" or "postgres".

Methods

TryGet

bool TryGet(string key, out byte[] bytes, out string checksum);

The object stored under key. False on a miss, and also when the stored bytes no longer match their checksum (the entry is removed, so the next put can replace it). Refreshes the entry's last-read time when it is more than SharedCacheKey.TouchIntervalSeconds old.

Put

bool Put(string key, byte[] bytes, string checksum);

Store bytes under key unless the key is already stored. True when this call wrote it, false when the key was already there (also the answer to a racing put). The caller has verified checksum (SharedCacheKey.Checksum) against bytes.

RemoveUnreadSince

int RemoveUnreadSince(DateTime cutoffUtc);

Remove every entry that was last read before cutoffUtc. Returns how many were removed.

Clear

int Clear();

Remove every entry. Returns how many were removed. Persisted entities are not affected.

Count

long Count();

How many objects the store holds.

TotalBytes

long TotalBytes();

The total size of the objects the store holds, in bytes.

On this page