Class CacheStatistics
Comprehensive cache statistics for tracking cache performance and usage across the messaging framework.
public sealed class CacheStatistics
- Inheritance
-
CacheStatistics
- Inherited Members
- Extension Methods
Properties
AverageAccessInterval
Gets or sets the average access interval.
public TimeSpan AverageAccessInterval { get; set; }
Property Value
- TimeSpan
The current AverageAccessInterval value.
AverageAccessTime
Gets or sets the average access time.
public TimeSpan AverageAccessTime { get; set; }
Property Value
- TimeSpan
The current AverageAccessTime value.
AverageGetTimeMs
Gets or sets the average get time in milliseconds.
public double AverageGetTimeMs { get; set; }
Property Value
- double
The current AverageGetTimeMs value.
AverageSetTimeMs
Gets or sets the average set time in milliseconds.
public double AverageSetTimeMs { get; set; }
Property Value
- double
The current AverageSetTimeMs value.
CacheHitRate
Gets or sets the cache hit rate (alias for HitRate).
public double CacheHitRate { get; set; }
Property Value
- double
The cache hit rate (alias for HitRate).
CacheHits
Gets or sets the cache hits (alias for Hits).
public long CacheHits { get; set; }
Property Value
- long
The cache hits (alias for Hits).
CacheId
Gets or sets the unique identifier for this cache instance (e.g., SagaId).
public string? CacheId { get; set; }
Property Value
CacheMisses
Gets or sets the cache misses (alias for Misses).
public long CacheMisses { get; set; }
Property Value
- long
The cache misses (alias for Misses).
CacheSize
Gets or sets the current cache size (alias for ItemCount, for backward compatibility).
public int CacheSize { get; set; }
Property Value
- int
The current cache size (alias for ItemCount, for backward compatibility).
CurrentCacheSize
Gets or sets the current cache size (alias for ItemCount, for backward compatibility).
public long CurrentCacheSize { get; set; }
Property Value
- long
The current cache size (alias for ItemCount, for backward compatibility).
CurrentSize
Gets or sets the current number of items in the cache (alias for ItemCount).
public int CurrentSize { get; set; }
Property Value
- int
The current number of items in the cache (alias for ItemCount).
EntryCount
Gets or sets the current number of entries in the cache (alias for ItemCount).
public long EntryCount { get; set; }
Property Value
- long
The current number of entries in the cache (alias for ItemCount).
Evictions
Gets or sets the number of items evicted due to capacity constraints.
public long Evictions { get; set; }
Property Value
- long
The number of items evicted due to capacity constraints.
Expirations
Gets or sets the number of items that expired based on TTL.
public long Expirations { get; set; }
Property Value
- long
The number of items that expired based on TTL.
HitCount
Gets or sets the hit count (alias for Hits).
public long HitCount { get; set; }
Property Value
- long
The hit count (alias for Hits).
HitRate
Gets or sets the cache hit rate as a percentage (0-100).
public double HitRate { get; set; }
Property Value
- double
The cache hit rate as a percentage (0-100).
HitRatio
Gets the cache hit ratio (0-1).
public double HitRatio { get; }
Property Value
- double
The cache hit ratio (0-1).
Hits
Gets or sets the number of cache hits.
public long Hits { get; set; }
Property Value
- long
The number of cache hits.
ItemCount
Gets or sets the current number of items in the cache.
public long ItemCount { get; set; }
Property Value
- long
The current number of items in the cache.
LastAccessTime
Gets or sets the last access time.
public DateTimeOffset LastAccessTime { get; set; }
Property Value
- DateTimeOffset
The current LastAccessTime value.
LastReset
Gets or sets the last reset time as DateTimeOffset.
public DateTimeOffset LastReset { get; set; }
Property Value
- DateTimeOffset
The current LastReset value.
LastResetTime
Gets or sets the last reset time.
public DateTimeOffset LastResetTime { get; set; }
Property Value
- DateTimeOffset
The current LastResetTime value.
LevelStatistics
Gets statistics by cache level (for multi-level caches).
public Dictionary<string, object>? LevelStatistics { get; init; }
Property Value
- Dictionary<string, object>
The current LevelStatistics value.
MaxSize
Gets or sets the maximum capacity of the cache.
public int MaxSize { get; set; }
Property Value
MemoryUsage
Gets or sets the total memory usage of cache in bytes (alias for TotalSizeBytes).
public long MemoryUsage { get; set; }
Property Value
- long
The total memory usage of cache in bytes (alias for TotalSizeBytes).
MissCount
Gets or sets the miss count (alias for Misses).
public long MissCount { get; set; }
Property Value
- long
The miss count (alias for Misses).
MissRate
Gets the cache miss rate as a percentage (0-100).
public double MissRate { get; }
Property Value
- double
The cache miss rate as a percentage (0-100).
Misses
Gets or sets the number of cache misses.
public long Misses { get; set; }
Property Value
- long
The number of cache misses.
RecommendedTtl
Gets or sets the recommended TTL.
public TimeSpan RecommendedTtl { get; set; }
Property Value
- TimeSpan
The current RecommendedTtl value.
SagaId
Gets or sets the Saga ID (specific to saga caching scenarios).
public string SagaId { get; set; }
Property Value
- string
The Saga ID (specific to saga caching scenarios).
SizeInBytes
Gets or sets the total size of cached items in bytes (alias for TotalSizeBytes).
public long SizeInBytes { get; set; }
Property Value
- long
The total size of cached items in bytes (alias for TotalSizeBytes).
TotalAccesses
Gets or sets the total number of accesses (alias for TotalRequests).
public int TotalAccesses { get; set; }
Property Value
- int
The total number of accesses (alias for TotalRequests).
TotalRequests
Gets or sets the total number of requests (hits + misses).
public long TotalRequests { get; set; }
Property Value
- long
The total number of requests (hits + misses).
TotalSize
Gets or sets the total size of cached items in bytes (alias for TotalSizeBytes).
public long TotalSize { get; set; }
Property Value
- long
The total size of cached items in bytes (alias for TotalSizeBytes).
TotalSizeBytes
Gets or sets the total size of cached items in bytes.
public long TotalSizeBytes { get; set; }
Property Value
- long
The total size of cached items in bytes.
Methods
AddSizeBytes(long)
Adds to the total size in bytes in a thread-safe manner.
public void AddSizeBytes(long bytes)
Parameters
byteslongThe number of bytes to add.
CreateSnapshot()
Creates a snapshot of the current statistics.
public CacheStatistics CreateSnapshot()
Returns
- CacheStatistics
A new CacheStatistics instance with copied values.
DecrementEntryCount()
Decrements the entry count in a thread-safe manner.
public void DecrementEntryCount()
IncrementEntryCount()
Increments the entry count in a thread-safe manner.
public void IncrementEntryCount()
IncrementEvictions()
Increments the evictions counter in a thread-safe manner.
public void IncrementEvictions()
IncrementExpirations()
Increments the expirations counter in a thread-safe manner.
public void IncrementExpirations()
IncrementHits()
Increments the hits counter in a thread-safe manner.
public void IncrementHits()
IncrementMisses()
Increments the misses counter in a thread-safe manner.
public void IncrementMisses()
Reset()
Resets all statistics to zero.
public void Reset()
SubtractSizeBytes(long)
Subtracts from the total size in bytes in a thread-safe manner.
public void SubtractSizeBytes(long bytes)
Parameters
byteslongThe number of bytes to subtract.