# DefaultCacheMonitor Methods

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

## ReportCacheSize(long) {#reportcachesize-long-a4ebfd39}

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

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/Monitors/DefaultCacheMonitor.cs#L97)

```csharp
public void ReportCacheSize(long totalCacheSizeInByte)
```

Called to report the total cache size.

### Parameters

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

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

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

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/Monitors/DefaultCacheMonitor.cs#L102-L113)

```csharp
public 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-cbb34e6d}

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

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/Monitors/DefaultCacheMonitor.cs#L82-L94)

```csharp
public 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-43733afe}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.defaultcachemonitor/methods/trackmemoryallocated-int-43733afe/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/Monitors/DefaultCacheMonitor.cs#L116)

```csharp
public void TrackMemoryAllocated(int memoryInByte)
```

Called when new memory is allocated by the cache.

### Parameters

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

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

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

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/Monitors/DefaultCacheMonitor.cs#L119)

```csharp
public void TrackMemoryReleased(int memoryInByte)
```

Called when memory returned to block pool.

### Parameters

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

## TrackMessagesAdded(long) {#trackmessagesadded-long-1cb5b98c}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.defaultcachemonitor/methods/trackmessagesadded-long-1cb5b98c/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/Monitors/DefaultCacheMonitor.cs#L122)

```csharp
public void TrackMessagesAdded(long messageAdded)
```

Called when messages are added to the cache.

### Parameters

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

## TrackMessagesPurged(long) {#trackmessagespurged-long-9e09be10}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.defaultcachemonitor/methods/trackmessagespurged-long-9e09be10/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/Monitors/DefaultCacheMonitor.cs#L125)

```csharp
public void TrackMessagesPurged(long messagePurged)
```

Called when messages are purged from the cache.

### Parameters

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