Skip to content

PooledQueueCache Constructors

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.

PooledQueueCache(ICacheDataAdapter, ILogger, ICacheMonitor, TimeSpan?, TimeSpan?)

View source
public PooledQueueCache(ICacheDataAdapter cacheDataAdapter, ILogger logger, ICacheMonitor cacheMonitor, TimeSpan? cacheMonitorWriteInterval, TimeSpan? purgeMetadataInterval = null)
Pooled queue cache is a cache of message that obtains resource from a pool

Parameters

cacheDataAdapterICacheDataAdapter
The cache data adapter.
loggerILogger
The logger.
cacheMonitorICacheMonitor
The cache monitor.
cacheMonitorWriteIntervalTimeSpan?
The cache monitor write interval. Only triggered for active caches.
purgeMetadataIntervalTimeSpan?
The interval after which to purge cache metadata.