Edytuj

Udostępnij za pośrednictwem


PooledQueueCache<TQueueMessage,TCachedMessage> 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<TQueueMessage,TCachedMessage> : Orleans.Providers.Streams.Common.IPurgeObservable<TCachedMessage> where TCachedMessage : struct
type PooledQueueCache<'QueueMessage, 'CachedMessage (requires 'CachedMessage : struct)> = class
    interface IPurgeObservable<'CachedMessage (requires 'CachedMessage : struct)>
Public Class PooledQueueCache(Of TQueueMessage, TCachedMessage)
Implements IPurgeObservable(Of TCachedMessage)

Type Parameters

TQueueMessage

Queue specific data

TCachedMessage

Tightly packed cached structure. Should only contain value types.

Inheritance
PooledQueueCache<TQueueMessage,TCachedMessage>
Implements

Constructors

PooledQueueCache<TQueueMessage,TCachedMessage>(ICacheDataAdapter<TQueueMessage, TCachedMessage>, ICacheDataComparer<TCachedMessage>, ILogger, ICacheMonitor, Nullable<TimeSpan>)

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

PooledQueueCache<TQueueMessage,TCachedMessage>(ICacheDataAdapter<TQueueMessage, TCachedMessage>, ICacheDataComparer<TCachedMessage>, Logger, ICacheMonitor, 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

Cached message count

Newest

Cached message most recently added

Oldest

Oldest message in cache

Methods

Add(List<TQueueMessage>, 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.

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