#### [Abblix\.SharedSignals](https://www.abblix.com/en/docs/api/abblix-sharedsignals 'index')
### [Abblix\.SharedSignals\.Transmitter](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter 'Abblix\.SharedSignals\.Transmitter')

## DistributedCacheEventOutbox Class

The outbox over the host's [Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.caching.distributed.idistributedcache 'Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache'): one entry per stream holding the
queue, so pending events survive a process restart when the store behind the cache does\. A
stream here is the receiver and the identifier together, as everywhere else\. The
tier is deliberate, and it is our decision rather than a permission the specification grants:
SSF 1\.0 Section 8\.1\.2\.1 lets a transmitter drop events held while a stream is PAUSED, and
requires transmission for an enabled one\. Treating the whole queue as cache\-tier follows the
delivery protocols' own tolerance for loss over a broken transport, and is why it belongs in
the cache tier rather than beside data that earns backups\.

```csharp
public sealed class DistributedCacheEventOutbox : Abblix.SharedSignals.Transmitter.IEventOutbox, System.IDisposable
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → DistributedCacheEventOutbox

Implements [IEventOutbox](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.IEventOutbox 'Abblix\.SharedSignals\.Transmitter\.IEventOutbox'), [System\.IDisposable](https://learn.microsoft.com/en-us/dotnet/api/system.idisposable 'System\.IDisposable')

### Remarks
[Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.caching.distributed.idistributedcache 'Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache') reads and writes whole values with no compare\-and\-set, so queue
            mutations are serialized through an in\-process gate per stream, taken under the same composed
            key the entry lives under \- so the gate and the entry cannot disagree about which stream is
            being guarded\. That gate excludes this
            instance's threads from each other and reaches no further, which makes this implementation
            correct for a SINGLE transmitter instance and only that: two instances mutating one stream's
            queue read the same value, each writes its own edit over the whole entry, and the later write
            silently discards the earlier one's\. No compare\-and\-set means the interface cannot express the
            fix either \- it is not a gap in this class\. A transmitter running more than one instance takes
            the outbox built on native list operations, `AddSharedSignalsRedisOutbox`\.
### Constructors

## DistributedCacheEventOutbox\(IDistributedCache\) Constructor {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.DistributedCacheEventOutbox(Microsoft.Extensions.Caching.Distributed.IDistributedCache)}

The outbox over the host's [Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.caching.distributed.idistributedcache 'Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache'): one entry per stream holding the
queue, so pending events survive a process restart when the store behind the cache does\. A
stream here is the receiver and the identifier together, as everywhere else\. The
tier is deliberate, and it is our decision rather than a permission the specification grants:
SSF 1\.0 Section 8\.1\.2\.1 lets a transmitter drop events held while a stream is PAUSED, and
requires transmission for an enabled one\. Treating the whole queue as cache\-tier follows the
delivery protocols' own tolerance for loss over a broken transport, and is why it belongs in
the cache tier rather than beside data that earns backups\.

```csharp
public DistributedCacheEventOutbox(Microsoft.Extensions.Caching.Distributed.IDistributedCache cache);
```
#### Parameters

###### `cache` [Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.caching.distributed.idistributedcache 'Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.DistributedCacheEventOutbox(Microsoft.Extensions.Caching.Distributed.IDistributedCache).cache}

The distributed cache the queues live in; the store is the host's
            choice\.

### Remarks
[Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.caching.distributed.idistributedcache 'Microsoft\.Extensions\.Caching\.Distributed\.IDistributedCache') reads and writes whole values with no compare\-and\-set, so queue
            mutations are serialized through an in\-process gate per stream, taken under the same composed
            key the entry lives under \- so the gate and the entry cannot disagree about which stream is
            being guarded\. That gate excludes this
            instance's threads from each other and reaches no further, which makes this implementation
            correct for a SINGLE transmitter instance and only that: two instances mutating one stream's
            queue read the same value, each writes its own edit over the whole entry, and the later write
            silently discards the earlier one's\. No compare\-and\-set means the interface cannot express the
            fix either \- it is not a gap in this class\. A transmitter running more than one instance takes
            the outbox built on native list operations, `AddSharedSignalsRedisOutbox`\.
### Methods

## DistributedCacheEventOutbox\.AcknowledgeAsync\(string, string, IReadOnlyCollection\<string\>, CancellationToken\) Method {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.AcknowledgeAsync(string,string,System.Collections.Generic.IReadOnlyCollection_string_,System.Threading.CancellationToken)}

Removes acknowledged SETs from a stream's queue, releasing the transmitter from
retaining them \(RFC 8936 Section 2\.2\)\. Identifiers with nothing to match are ignored \-
an acknowledgement can only arrive for something that was once here\.

```csharp
public System.Threading.Tasks.Task AcknowledgeAsync(string receiverId, string streamId, System.Collections.Generic.IReadOnlyCollection<string> jwtIds, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `receiverId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.AcknowledgeAsync(string,string,System.Collections.Generic.IReadOnlyCollection_string_,System.Threading.CancellationToken).receiverId}

The receiver the stream belongs to\.

###### `streamId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.AcknowledgeAsync(string,string,System.Collections.Generic.IReadOnlyCollection_string_,System.Threading.CancellationToken).streamId}

The stream whose queue is acknowledged\.

###### `jwtIds` [System\.Collections\.Generic\.IReadOnlyCollection&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlycollection-1 'System\.Collections\.Generic\.IReadOnlyCollection\`1')[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlycollection-1 'System\.Collections\.Generic\.IReadOnlyCollection\`1') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.AcknowledgeAsync(string,string,System.Collections.Generic.IReadOnlyCollection_string_,System.Threading.CancellationToken).jwtIds}

The "jti" values being acknowledged\.

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.AcknowledgeAsync(string,string,System.Collections.Generic.IReadOnlyCollection_string_,System.Threading.CancellationToken).cancellationToken}

Cancels I/O a durable implementation performs\.

Implements [AcknowledgeAsync\(string, string, IReadOnlyCollection&lt;string&gt;, CancellationToken\)](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.IEventOutbox#Abblix.SharedSignals.Transmitter.IEventOutbox.AcknowledgeAsync(string,string,System.Collections.Generic.IReadOnlyCollection_string_,System.Threading.CancellationToken) 'Abblix\.SharedSignals\.Transmitter\.IEventOutbox\.AcknowledgeAsync\(string, string, System\.Collections\.Generic\.IReadOnlyCollection\<string\>, System\.Threading\.CancellationToken\)')

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')

## DistributedCacheEventOutbox\.ClearAsync\(string, string, CancellationToken\) Method {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.ClearAsync(string,string,System.Threading.CancellationToken)}

Drops a stream's whole queue \- the companion of deleting or disabling the stream, whose
events are not held for later \(SSF 1\.0 Sections 8\.1\.1\.5, 8\.1\.2\.1\)\.

```csharp
public System.Threading.Tasks.Task ClearAsync(string receiverId, string streamId, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `receiverId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.ClearAsync(string,string,System.Threading.CancellationToken).receiverId}

The receiver the stream belongs to\.

###### `streamId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.ClearAsync(string,string,System.Threading.CancellationToken).streamId}

The stream whose queue is dropped\.

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.ClearAsync(string,string,System.Threading.CancellationToken).cancellationToken}

Cancels I/O a durable implementation performs\.

Implements [ClearAsync\(string, string, CancellationToken\)](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.IEventOutbox#Abblix.SharedSignals.Transmitter.IEventOutbox.ClearAsync(string,string,System.Threading.CancellationToken) 'Abblix\.SharedSignals\.Transmitter\.IEventOutbox\.ClearAsync\(string, string, System\.Threading\.CancellationToken\)')

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')

## DistributedCacheEventOutbox\.Dispose\(\) Method {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.Dispose()}

Performs application\-defined tasks associated with freeing, releasing, or resetting unmanaged resources\.

```csharp
public void Dispose();
```

Implements [Dispose\(\)](https://learn.microsoft.com/en-us/dotnet/api/system.idisposable.dispose 'System\.IDisposable\.Dispose')

## DistributedCacheEventOutbox\.EnqueueAsync\(string, string, OutboxItem, CancellationToken\) Method {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.EnqueueAsync(string,string,Abblix.SharedSignals.Transmitter.OutboxItem,System.Threading.CancellationToken)}

Appends a SET to a stream's queue\.

```csharp
public System.Threading.Tasks.Task EnqueueAsync(string receiverId, string streamId, Abblix.SharedSignals.Transmitter.OutboxItem item, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `receiverId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.EnqueueAsync(string,string,Abblix.SharedSignals.Transmitter.OutboxItem,System.Threading.CancellationToken).receiverId}

The receiver the stream belongs to\.

###### `streamId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.EnqueueAsync(string,string,Abblix.SharedSignals.Transmitter.OutboxItem,System.Threading.CancellationToken).streamId}

The stream the SET was minted for\.

###### `item` [OutboxItem](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.OutboxItem 'Abblix\.SharedSignals\.Transmitter\.OutboxItem') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.EnqueueAsync(string,string,Abblix.SharedSignals.Transmitter.OutboxItem,System.Threading.CancellationToken).item}

The minted SET\.

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.EnqueueAsync(string,string,Abblix.SharedSignals.Transmitter.OutboxItem,System.Threading.CancellationToken).cancellationToken}

Cancels I/O a durable implementation performs\.

Implements [EnqueueAsync\(string, string, OutboxItem, CancellationToken\)](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.IEventOutbox#Abblix.SharedSignals.Transmitter.IEventOutbox.EnqueueAsync(string,string,Abblix.SharedSignals.Transmitter.OutboxItem,System.Threading.CancellationToken) 'Abblix\.SharedSignals\.Transmitter\.IEventOutbox\.EnqueueAsync\(string, string, Abblix\.SharedSignals\.Transmitter\.OutboxItem, System\.Threading\.CancellationToken\)')

#### Returns
[System\.Threading\.Tasks\.Task](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task 'System\.Threading\.Tasks\.Task')

## DistributedCacheEventOutbox\.PendingAsync\(string, string, Nullable\<int\>, CancellationToken\) Method {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.PendingAsync(string,string,System.Nullable_int_,System.Threading.CancellationToken)}

Reads the unacknowledged head of a stream's queue, oldest first, without removing
anything \- redelivery of the unacknowledged is the delivery protocols' own semantics\.

```csharp
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Abblix.SharedSignals.Transmitter.OutboxItem>> PendingAsync(string receiverId, string streamId, System.Nullable<int> maxCount=null, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `receiverId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.PendingAsync(string,string,System.Nullable_int_,System.Threading.CancellationToken).receiverId}

The receiver the stream belongs to\.

###### `streamId` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.PendingAsync(string,string,System.Nullable_int_,System.Threading.CancellationToken).streamId}

The stream whose queue is read\.

###### `maxCount` [System\.Nullable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')[System\.Int32](https://learn.microsoft.com/en-us/dotnet/api/system.int32 'System\.Int32')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.PendingAsync(string,string,System.Nullable_int_,System.Threading.CancellationToken).maxCount}

The most items to return; null returns everything pending, mirroring an absent
"maxEvents" \(RFC 8936 Section 2\.2\)\.

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.SharedSignals.Transmitter.DistributedCacheEventOutbox.PendingAsync(string,string,System.Nullable_int_,System.Threading.CancellationToken).cancellationToken}

Cancels I/O a durable implementation performs\.

Implements [PendingAsync\(string, string, Nullable&lt;int&gt;, CancellationToken\)](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.IEventOutbox#Abblix.SharedSignals.Transmitter.IEventOutbox.PendingAsync(string,string,System.Nullable_int_,System.Threading.CancellationToken) 'Abblix\.SharedSignals\.Transmitter\.IEventOutbox\.PendingAsync\(string, string, System\.Nullable\<int\>, System\.Threading\.CancellationToken\)')

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[System\.Collections\.Generic\.IReadOnlyList&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlylist-1 'System\.Collections\.Generic\.IReadOnlyList\`1')[OutboxItem](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.OutboxItem 'Abblix\.SharedSignals\.Transmitter\.OutboxItem')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.ireadonlylist-1 'System\.Collections\.Generic\.IReadOnlyList\`1')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')
