aboutsummaryrefslogtreecommitdiff
path: root/plugins/VNLib.Data.Caching.Providers.Redis/src/RedisClientCacheEntry.cs
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-02-14 14:23:53 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2024-02-14 14:23:53 -0500
commit6b87785026ca57d6f41cff87ddbd066362f3cacc (patch)
tree74cddbca5eebcec7948e706bd7b742b19e55eeb6 /plugins/VNLib.Data.Caching.Providers.Redis/src/RedisClientCacheEntry.cs
parentc0e2a71b7b4081117d87c2c34c1b2afb8d511732 (diff)
Squashed commit of the following:
commit 456ead9bc8b0f61357bae93152ad0403c4940101 Author: vnugent <public@vaughnnugent.com> Date: Tue Feb 13 14:46:35 2024 -0500 fix: #1 shared cluster index on linux & latested core updates commit a481d63f964a5d5204cac2e95141f37f9a28d573 Author: vnugent <public@vaughnnugent.com> Date: Tue Jan 23 15:43:50 2024 -0500 cache extension api tweaks
Diffstat (limited to 'plugins/VNLib.Data.Caching.Providers.Redis/src/RedisClientCacheEntry.cs')
-rw-r--r--plugins/VNLib.Data.Caching.Providers.Redis/src/RedisClientCacheEntry.cs14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/VNLib.Data.Caching.Providers.Redis/src/RedisClientCacheEntry.cs b/plugins/VNLib.Data.Caching.Providers.Redis/src/RedisClientCacheEntry.cs
index f80c750..360be58 100644
--- a/plugins/VNLib.Data.Caching.Providers.Redis/src/RedisClientCacheEntry.cs
+++ b/plugins/VNLib.Data.Caching.Providers.Redis/src/RedisClientCacheEntry.cs
@@ -211,8 +211,8 @@ namespace VNLib.Data.Caching.Providers.Redis
///<inheritdoc/>
public async Task AddOrUpdateAsync<T>(string key, string? newKey, T value, ICacheObjectSerializer serialzer, CancellationToken cancellation)
{
- _ = key ?? throw new ArgumentNullException(nameof(key));
- _ = serialzer ?? throw new ArgumentNullException(nameof(serialzer));
+ ArgumentException.ThrowIfNullOrWhiteSpace(key);
+ ArgumentNullException.ThrowIfNull(serialzer);
//Alloc update buffer
using AddOrUpdateBuffer buffer = new(_defaultHeap, InitialWriterBufferSize, false);
@@ -231,7 +231,7 @@ namespace VNLib.Data.Caching.Providers.Redis
}
///<inheritdoc/>
- public async Task AddOrUpdateAsync<T>(string key, string? newKey, ObjectDataReader<T> callback, T state, CancellationToken cancellation)
+ public async Task AddOrUpdateAsync<T>(string key, string? newKey, ObjectDataGet<T> callback, T state, CancellationToken cancellation)
{
/*
* Because the redis database only allows ReadonlyMemory when
@@ -253,7 +253,7 @@ namespace VNLib.Data.Caching.Providers.Redis
await _database.KeyRenameAsync(key, newKey);
}
- static IMemoryOwner<byte> AllocAndCopy(ObjectDataReader<T> callback, T state, IUnmangedHeap heap, ref int length)
+ static IMemoryOwner<byte> AllocAndCopy(ObjectDataGet<T> callback, T state, IUnmangedHeap heap, ref int length)
{
//Get the buffer from the callback
ReadOnlySpan<byte> data = callback(state);
@@ -276,7 +276,8 @@ namespace VNLib.Data.Caching.Providers.Redis
///<inheritdoc/>
public async Task<T?> GetAsync<T>(string key, ICacheObjectDeserializer deserializer, CancellationToken cancellation)
{
- _ = deserializer ?? throw new ArgumentNullException(nameof(deserializer));
+ ArgumentException.ThrowIfNullOrWhiteSpace(key);
+ ArgumentNullException.ThrowIfNull(deserializer);
//Try to get the value from the cache
RedisValue value = await _database.StringGetAsync(key);
@@ -293,7 +294,8 @@ namespace VNLib.Data.Caching.Providers.Redis
///<inheritdoc/>
public async Task GetAsync<T>(string key, ObjectDataSet<T> callback, T state, CancellationToken cancellation)
{
- _ = callback ?? throw new ArgumentNullException(nameof(callback));
+ ArgumentException.ThrowIfNullOrWhiteSpace(key);
+ ArgumentNullException.ThrowIfNull(callback);
//Try to get the value from the cache
RedisValue value = await _database.StringGetAsync(key);