Skip to content

Commit

Permalink
Create interface for dist metadata cache options
Browse files Browse the repository at this point in the history
  • Loading branch information
westin-m committed Jul 12, 2024
1 parent 1db51db commit 7b70599
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Microsoft.Extensions.Caching.Distributed;

namespace Microsoft.IdentityModel.Protocols.Configuration
{
/// <summary>
/// Specifies the DistributedMetadataCacheOptions which can be used to configure the distributed metadata cache.
/// </summary>
public class DistributedMetadataCacheOptions
{
/// <inheritdoc/>
public IDistributedCache DistributedCache { get; set; }

/// <inheritdoc/>
public IByteArrayCacheTransformer ByteArrayCacheTransformer { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Microsoft.IdentityModel.Protocols.Configuration
{
/// <summary>
/// Interface that defines methods to transform byte arrays before they are written to a cache and after they are retrieved from a cache.
/// </summary>
public interface IByteArrayCacheTransformer
{
/// <summary>
/// Transform the provided <see cref="byte"/> array before it is written to a cache.
/// </summary>
/// <param name="data">The <see cref="byte"/>s to be transformed.</param>
/// <returns>The result of the transformation.</returns>
byte[] TransformBeforeCaching(byte[] data);

/// <summary>
/// TRansform the provided <see cref="byte"/> array after it is retrieved from a cache.
/// </summary>
/// <param name="data">The <see cref="byte"/>s to be transformed.</param>
/// <returns>The result of the transformation.</returns>
byte[] TransformAfterRetrieval(byte[] data);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 7b70599

Please sign in to comment.