# ICacheMonitor Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.icachemonitor/)

## ReportCacheSize(long) {#reportcachesize-long-72f7d7e2}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.icachemonitor/methods/reportcachesize-long-72f7d7e2/)

```csharp
public abstract void ReportCacheSize(long totalCacheSizeInBytes)
```

Called to report the total cache size.

### Parameters

- `totalCacheSizeInBytes` (`long`): The total cache size in bytes.

## ReportMessageStatistics(DateTime?, DateTime?, DateTime?, long) {#reportmessagestatistics-system-datetime-nullable-system-datetime-nullable-system-c323f922}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.icachemonitor/methods/reportmessagestatistics-system-datetime-nullable-system-datetime-nullable-system-c323f922/)

```csharp
public abstract void ReportMessageStatistics(DateTime? oldestMessageEnqueueTimeUtc, DateTime? oldestMessageDequeueTimeUtc, DateTime? newestMessageEnqueueTimeUtc, long totalMessageCount)
```

Called to report cache status metrics.

### Parameters

- `oldestMessageEnqueueTimeUtc` (`DateTime?`): The time in UTC when the oldest message was enqueued to the queue.
- `oldestMessageDequeueTimeUtc` (`DateTime?`): The time in UTC when the oldest message was read from the queue and put in the cache.
- `newestMessageEnqueueTimeUtc` (`DateTime?`): The time in UTC when the newest message was enqueued to the queue.
- `totalMessageCount` (`long`): The total message count.

## TrackCachePressureMonitorStatusChange(string, bool, double?, double?, double?) {#trackcachepressuremonitorstatuschange-string-bool-double-nullable-double-nullabl-e20217e9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.icachemonitor/methods/trackcachepressuremonitorstatuschange-string-bool-double-nullable-double-nullabl-e20217e9/)

```csharp
public abstract void TrackCachePressureMonitorStatusChange(string pressureMonitorType, bool underPressure, double? cachePressureContributionCount, double? currentPressure, double? flowControlThreshold)
```

Called when the cache pressure monitor encounter a status change.

### Parameters

- `pressureMonitorType` (`string`): Type of the pressure monitor.
- `underPressure` (`bool`): if set to `true`, the cache is under pressure.
- `cachePressureContributionCount` (`double?`): The cache pressure contribution count.
- `currentPressure` (`double?`): The current pressure.
- `flowControlThreshold` (`double?`): The flow control threshold.

## TrackMemoryAllocated(int) {#trackmemoryallocated-int-641293f7}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.icachemonitor/methods/trackmemoryallocated-int-641293f7/)

```csharp
public abstract void TrackMemoryAllocated(int memoryInBytes)
```

Called when new memory is allocated by the cache.

### Parameters

- `memoryInBytes` (`int`): The memory in bytes.

## TrackMemoryReleased(int) {#trackmemoryreleased-int-e6f7fcb3}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.icachemonitor/methods/trackmemoryreleased-int-e6f7fcb3/)

```csharp
public abstract void TrackMemoryReleased(int memoryInBytes)
```

Called when memory returned to block pool.

### Parameters

- `memoryInBytes` (`int`): The memory in bytes.

## TrackMessagesAdded(long) {#trackmessagesadded-long-0601404f}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.icachemonitor/methods/trackmessagesadded-long-0601404f/)

```csharp
public abstract void TrackMessagesAdded(long messagesAdded)
```

Called when messages are added to the cache.

### Parameters

- `messagesAdded` (`long`): The number of messages added.

## TrackMessagesPurged(long) {#trackmessagespurged-long-648bef2b}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.icachemonitor/methods/trackmessagespurged-long-648bef2b/)

```csharp
public abstract void TrackMessagesPurged(long messagesPurged)
```

Called when messages are purged from the cache.

### Parameters

- `messagesPurged` (`long`): The number of messages purged.
