Skip to content

Commit

Permalink
Add required jsonTypeInfo parameter to all ICachingService methods
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanGreve committed Aug 29, 2024
1 parent 10b72eb commit 864848b
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions AdvancedSystems.Core.Abstractions/ICachingService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading;
using System.Text.Json.Serialization.Metadata;
using System.Threading;
using System.Threading.Tasks;

namespace AdvancedSystems.Core.Abstractions;
Expand All @@ -8,6 +9,8 @@ namespace AdvancedSystems.Core.Abstractions;
/// </summary>
public interface ICachingService
{
#region Methods

/// <summary>
/// Sets a values in the cache asynchronously.
/// </summary>
Expand All @@ -20,13 +23,16 @@ public interface ICachingService
/// <param name="value">
/// The values to set in the cache.
/// </param>
/// <param name="jsonTypeInfo">
/// The metadata for the specified type.
/// </param>
/// <param name="cancellationToken">
/// Propagates notification that operations should be cancelled.
/// </param>
/// <returns>
/// A ValueTask representing the asynchronous operation.
/// </returns>
ValueTask SetAsync<T>(string key, T value, CancellationToken cancellationToken = default) where T : class;
ValueTask SetAsync<T>(string key, T value, JsonTypeInfo<T> jsonTypeInfo, CancellationToken cancellationToken = default) where T : class;

/// <summary>
/// Sets a values in the cache asynchronously.
Expand All @@ -40,6 +46,9 @@ public interface ICachingService
/// <param name="value">
/// The values to set in the cache.
/// </param>
/// <param name="jsonTypeInfo">
/// The metadata for the specified type.
/// </param>
/// <param name="options">
/// The cache options for the value.
/// </param>
Expand All @@ -49,7 +58,7 @@ public interface ICachingService
/// <returns>
/// A ValueTask representing the asynchronous operation.
/// </returns>
ValueTask SetAsync<T>(string key, T value, CacheOptions options, CancellationToken cancellationToken = default) where T : class;
ValueTask SetAsync<T>(string key, T value, JsonTypeInfo<T> jsonTypeInfo, CacheOptions options, CancellationToken cancellationToken = default) where T : class;

/// <summary>
/// Gets a values from the cache asynchronously.
Expand All @@ -60,12 +69,17 @@ public interface ICachingService
/// <param name="key">
/// A string identifying the requested values.
/// </param>
/// <param name="jsonTypeInfo">
/// The metadata for the specified type.
/// </param>
/// <param name="cancellationToken">
/// Propagates notification that operations should be cancelled.
/// </param>
/// <returns>
/// A ValueTask containing the result of type <typeparamref name="T"/> representing the asynchronous
/// operation. The result is null if <paramref name="key"/> can not be identified in the cache.
/// </returns>
ValueTask<T?> GetAsync<T>(string key, CancellationToken cancellationToken = default) where T : class;
ValueTask<T?> GetAsync<T>(string key, JsonTypeInfo<T> jsonTypeInfo, CancellationToken cancellationToken = default) where T : class;

#endregion
}

0 comments on commit 864848b

Please sign in to comment.