# SimpleQueueCache Methods

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

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

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.simplequeuecache/methods/addtocache-system-collections-generic-ilist-orleans-streams-ibatchcontainer-f50c9554/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/SimpleCache/SimpleQueueCache.cs#L135-L142)

```csharp
public virtual void AddToCache(IList<IBatchContainer> msgs)
```

Adds messages to the cache.

### Parameters

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

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

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.simplequeuecache/methods/getcachecursor-orleans-runtime-streamid-orleans-streams-streamsequencetoken-a813ee1c/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/SimpleCache/SimpleQueueCache.cs#L147-L149)

```csharp
public virtual 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.

## GetMaxAddCount {#getmaxaddcount-ae250983}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.simplequeuecache/methods/getmaxaddcount-ae250983/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/SimpleCache/SimpleQueueCache.cs#L59)

```csharp
public int GetMaxAddCount()
```

Gets the maximum number of items that can be added.

### Returns

The maximum number of items that can be added.

## IsUnderPressure {#isunderpressure-0a30a51e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.simplequeuecache/methods/isunderpressure-0a30a51e/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/SimpleCache/SimpleQueueCache.cs#L80)

```csharp
public virtual 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-389ac8f9}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.streaming/orleans.providers.streams.common.simplequeuecache/methods/trypurgefromcache-out-system-collections-generic-ilist-orleans-streams-ibatchcon-389ac8f9/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Streaming/Common/SimpleCache/SimpleQueueCache.cs#L87-L103)

```csharp
public virtual 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.
