namespace Microsoft.Extensions.Caching.Distributed {
public static class DistributedCacheExtensions {
- public static string GetString(this IDistributedCache cache, string key);
+ public static string? GetString(this IDistributedCache cache, string key);
- public static Task<string> GetStringAsync(this IDistributedCache cache, string key, CancellationToken token = default(CancellationToken));
+ public static Task<string?> GetStringAsync(this IDistributedCache cache, string key, CancellationToken token = default(CancellationToken));
}
public interface IDistributedCache {
- byte[] Get(string key);
+ byte[]? Get(string key);
- Task<byte[]> GetAsync(string key, CancellationToken token = default(CancellationToken));
+ Task<byte[]?> GetAsync(string key, CancellationToken token = default(CancellationToken));
}
public class MemoryDistributedCache : IDistributedCache {
- public byte[] Get(string key);
+ public byte[]? Get(string key);
- public Task<byte[]> GetAsync(string key, CancellationToken token = default(CancellationToken));
+ public Task<byte[]?> GetAsync(string key, CancellationToken token = default(CancellationToken));
}
}