Skip to content

IQueueCache Methods

Provides cached access to messages received from a stream queue.

AddToCache(IList<IBatchContainer>)

abstract
public abstract void AddToCache(IList<IBatchContainer> messages)
Adds messages to the cache.

Parameters

messagesIList<IBatchContainer>
The message batches.

GetCacheCursor(StreamId, StreamSequenceToken?)

abstract
[System.Obsolete(Use TryGetCacheCursor instead.)]
public abstract IQueueCacheCursor GetCacheCursor(StreamId streamId, StreamSequenceToken? token)
Acquire a stream message cursor. This can be used to retrieve messages from the cache starting at the location indicated by the provided token.

Parameters

streamIdStreamId
The stream identifier.
tokenStreamSequenceToken?
The token.

Returns

The queue cache cursor.

Exceptions

Orleans.Streams.QueueCacheMissException
The requested token is older than the messages retained by the cache.

IsUnderPressure

abstract
public abstract bool IsUnderPressure()
Returns true if this cache is under pressure, false otherwise.

Returns

true if this cache is under pressure; otherwise, false.

TryGetCacheCursor(StreamId, StreamSequenceToken?)

virtual
View source
public virtual QueueCacheCursorResult<IQueueCacheCursor> TryGetCacheCursor(StreamId streamId, StreamSequenceToken? token)
Attempts to acquire a stream message cursor at the location indicated by the provided token.

Parameters

streamIdStreamId
The stream identifier.
tokenStreamSequenceToken?
The token.

Returns

A successful result containing the acquired cursor, or a cache-miss result containing the unavailable position and current cache bounds.

TryGetCacheCursorAtPosition(StreamId, StreamSubscriptionStartPosition)

virtual
View source
public virtual QueueCacheCursorResult<IQueueCacheCursor> TryGetCacheCursorAtPosition(StreamId streamId, StreamSubscriptionStartPosition startPosition)
Attempts to acquire a stream message cursor at the specified subscription start position.

Parameters

streamIdStreamId
The stream identifier.
startPositionStreamSubscriptionStartPosition
The initial subscription position.

Returns

A successful result containing the acquired cursor, a cache-miss result containing the unavailable position and current cache bounds, or QueueCacheCursorResultKind.

Exceptions

System.ArgumentOutOfRangeException
startPosition is not defined.

TryPurgeFromCache(IList<IBatchContainer>)

abstract
public abstract bool TryPurgeFromCache(out IList<IBatchContainer> purgedItems)
Requests that the cache purge any items that can be purged.

Parameters

purgedItemsIList<IBatchContainer>
The purged items.

Returns

true if items were successfully purged from the cache., false otherwise.

UpdateDeliveryProgress(StreamSequenceToken?, DateTime)

virtual
View source
public virtual void UpdateDeliveryProgress(StreamSequenceToken? earliestSubscriptionToken, DateTime utcNow)
Updates the cache with the current delivery progress of all active subscriptions.

Parameters

earliestSubscriptionTokenStreamSequenceToken?
The earliest last processed sequence token across registered subscriptions. A null value indicates that there are no active subscriptions. The token is only valid for the duration of the call and must not be stored.
utcNowDateTime
The current UTC time.