Edit

Share via


PooledQueueCache Class

Definition

The PooledQueueCache is a cache that is intended to serve as a message cache in an IQueueCache. It is capable of storing large numbers of messages (gigs worth of messages) for extended periods of time (minutes to indefinite), while incurring a minimal performance hit due to garbage collection. This pooled cache allocates memory and never releases it. It keeps freed resources available in pools that remain in application use through the life of the service. This means these objects go to gen2, are compacted, and then stay there. This is relatively cheap, as the only cost they now incur is the cost of checking to see if they should be freed in each collection cycle. Since this cache uses small numbers of large objects with relatively simple object graphs, they are less costly to check then large numbers of smaller objects with more complex object graphs. For performance reasons this cache is designed to more closely align with queue specific data. This is, in part, why, unlike the SimpleQueueCache, this cache does not implement IQueueCache. It is intended to be used in queue specific implementations of IQueueCache.

public class PooledQueueCache : Orleans.Providers.Streams.Common.IPurgeObservable
type PooledQueueCache = class
    interface IPurgeObservable
Public Class PooledQueueCache
Implements IPurgeObservable
Inheritance
PooledQueueCache
Implements

Constructors

PooledQueueCache(ICacheDataAdapter, ILogger, ICacheMonitor, Nullable<TimeSpan>, Nullable<TimeSpan>)

Pooled queue cache is a cache of message that obtains resource from a pool

Properties

IsEmpty

Indicates whether the cache is empty

ItemCount

Gets the cached message count.

Newest

Gets the cached message most recently added.

Oldest

Gets the oldest message in cache.

Methods

Add(List<CachedMessage>, DateTime)

Add a list of queue message to the cache

GetCursor(IStreamIdentity, StreamSequenceToken)

Acquires a cursor to enumerate through the messages in the cache at the provided sequenceToken, filtered on the specified stream.

GetCursor(StreamId, StreamSequenceToken)

Acquires a cursor to enumerate through the messages in the cache at the provided sequenceToken, filtered on the specified stream.

RemoveOldestMessage()

Remove oldest message in the cache, remove oldest block too if the block is empty

TryGetNextMessage(Object, IBatchContainer)

Acquires the next message in the cache at the provided cursor

Applies to