mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
b19860b8a8
* Move Purview integration logic into middleware * Improve error handling and user id management * Rename purview package * Handle 402s more explicitly; add Middleware generation methods; don't ignore exceptions * Use DI container; pass scope id to PC * Add protection scope caching * Wrap more exceptions in PurviewClient * Remove block check dedup; add tests * Refactor PurviewWrapper intialization; Add unit tests * Use different .Use method and add IDisposable stub * Add background job processing for Purview * Misc comment cleanup * Apply copilot comments * Fix formatting * Formatting other files to fix pipeline * Small updates to settings and exceptions * Add README * Move Purview sample * Address review comments and update XML comments * Newline after namespace * Move public Purview classes to single namespace; Clean up csproj and slnx * Commit the renames * Remove unused openAI dependency --------- Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
43 lines
1.9 KiB
C#
43 lines
1.9 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Microsoft.Agents.AI.Purview;
|
|
|
|
/// <summary>
|
|
/// Manages caching of values.
|
|
/// </summary>
|
|
internal interface ICacheProvider
|
|
{
|
|
/// <summary>
|
|
/// Get a value from the cache.
|
|
/// </summary>
|
|
/// <typeparam name="TKey">The type of the key in the cache. Used for serialization.</typeparam>
|
|
/// <typeparam name="TValue">The type of the value in the cache. Used for serialization.</typeparam>
|
|
/// <param name="key">The key to look up in the cache.</param>
|
|
/// <param name="cancellationToken">A cancellation token for the async operation.</param>
|
|
/// <returns>The value in the cache. Null or default if no value is present.</returns>
|
|
Task<TValue?> GetAsync<TKey, TValue>(TKey key, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Set a value in the cache.
|
|
/// </summary>
|
|
/// <typeparam name="TKey">The type of the key in the cache. Used for serialization.</typeparam>
|
|
/// <typeparam name="TValue">The type of the value in the cache. Used for serialization.</typeparam>
|
|
/// <param name="key">The key to identify the cache entry.</param>
|
|
/// <param name="value">The value to cache.</param>
|
|
/// <param name="cancellationToken">A cancellation token for the async operation.</param>
|
|
/// <returns>A task for the async operation.</returns>
|
|
Task SetAsync<TKey, TValue>(TKey key, TValue value, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Removes a value from the cache.
|
|
/// </summary>
|
|
/// <typeparam name="TKey">The type of the key.</typeparam>
|
|
/// <param name="key">The key to identify the cache entry.</param>
|
|
/// <param name="cancellationToken">The cancellation token for the async operation.</param>
|
|
/// <returns>A task for the async operation.</returns>
|
|
Task RemoveAsync<TKey>(TKey key, CancellationToken cancellationToken);
|
|
}
|