# IQueueCache Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.iqueuecache/)

## AddToCache(IList&lt;IBatchContainer&gt;) {#addtocache-system-collections-generic-ilist-orleans-streams-ibatchcontainer-342d0e2a}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.iqueuecache/methods/addtocache-system-collections-generic-ilist-orleans-streams-ibatchcontainer-342d0e2a/)

```csharp
public abstract void AddToCache(IList<IBatchContainer> messages)
```

Adds messages to the cache.

### Parameters

- `messages` (`IList<IBatchContainer>`): The message batches.

## GetCacheCursor(StreamId, StreamSequenceToken) {#getcachecursor-orleans-runtime-streamid-orleans-streams-streamsequencetoken-6677c8a6}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.iqueuecache/methods/getcachecursor-orleans-runtime-streamid-orleans-streams-streamsequencetoken-6677c8a6/)

```csharp
public abstract IQueueCacheCursor GetCacheCursor(StreamId streamId, StreamSequenceToken token)
```

Acquire a stream message cursor. This can be used to retrieve messages from the cache starting at the location indicated by the provided token.

### Parameters

- `streamId` (`StreamId`): The stream identifier.
- `token` (`StreamSequenceToken`): The token.

### Returns

The queue cache cursor.

## IsUnderPressure {#isunderpressure-4a4f9226}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.iqueuecache/methods/isunderpressure-4a4f9226/)

```csharp
public abstract bool IsUnderPressure()
```

Returns `true` if this cache is under pressure, `false` otherwise.

### Returns

`true` if this cache is under pressure; otherwise, `false`.

## TryPurgeFromCache(IList&lt;IBatchContainer&gt;) {#trypurgefromcache-out-system-collections-generic-ilist-orleans-streams-ibatchcon-f7446781}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.iqueuecache/methods/trypurgefromcache-out-system-collections-generic-ilist-orleans-streams-ibatchcon-f7446781/)

```csharp
public abstract bool TryPurgeFromCache(out IList<IBatchContainer> purgedItems)
```

Requests that the cache purge any items that can be purged.

### Parameters

- `purgedItems` (`IList<IBatchContainer>`): The purged items.

### Returns

`true` if items were successfully purged from the cache., `false` otherwise.

## UpdateDeliveryProgress(StreamSequenceToken?, DateTime) {#updatedeliveryprogress-orleans-streams-streamsequencetoken-nullable-system-datet-4ea207b9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.streams.iqueuecache/methods/updatedeliveryprogress-orleans-streams-streamsequencetoken-nullable-system-datet-4ea207b9/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/QueueAdapters/IQueueCache.cs#L46)

```csharp
public virtual void UpdateDeliveryProgress(StreamSequenceToken? earliestSubscriptionToken, DateTime utcNow)
```

Updates the cache with the current delivery progress of all active subscriptions.

### Parameters

- `earliestSubscriptionToken` (`StreamSequenceToken?`): The earliest last processed sequence token across registered subscriptions. A `null` value indicates that there are no active subscriptions. The token is only valid for the duration of the call and must not be stored.
- `utcNow` (`DateTime`): The current UTC time.
