Skip to content

IGrainDirectoryCache Methods

Caches grain directory entries.

AddOrUpdate(GrainAddress, int)

abstract
public abstract void AddOrUpdate(GrainAddress value, int version)
Adds a new entry with the given version into the cache: key (grain) --> value The new entry will override any existing entry under the given key, regardless of the stored version

Parameters

valueGrainAddress
value to add
versionint
version for the value

Clear

abstract
public abstract void Clear()
Clear the cache, deleting all entries.

LookUp(GrainId, GrainAddress, int)

abstract
public abstract bool LookUp(GrainId key, out GrainAddress result, out int version)
Looks up the cached value and version by the given key

Parameters

keyGrainId
key for the lookup
resultGrainAddress
value if the key is found, undefined otherwise
versionint
version of cached value if the key is found, undefined otherwise

Returns

true if the given key is in the cache

Remove(GrainAddress)

abstract
public abstract bool Remove(GrainAddress key)
Removes an entry from the cache given its key

Parameters

keyGrainAddress
key to remove

Returns

True if the entry was in the cache and the removal was successful

Remove(GrainId)

abstract
public abstract bool Remove(GrainId key)
Removes an entry from the cache given its key

Parameters

keyGrainId
key to remove

Returns

True if the entry was in the cache and the removal was successful