aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-07-04 23:57:13 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-07-04 23:57:13 -0400
commit5e8f5f87b243930e17bfe99a34e170161204b4e1 (patch)
tree7a6c75e306e6353becbfa041b71e710d50e9ab87
parentb409ce938709d153c42f8127def776cb81cc8c26 (diff)
analyzer pass
-rw-r--r--lib/VNLib.Data.Caching.Extensions/src/VNCacheClusterClient.cs1
-rw-r--r--plugins/VNLib.Data.Caching.Providers.VNCache/src/AddOrUpdateBuffer.cs18
2 files changed, 6 insertions, 13 deletions
diff --git a/lib/VNLib.Data.Caching.Extensions/src/VNCacheClusterClient.cs b/lib/VNLib.Data.Caching.Extensions/src/VNCacheClusterClient.cs
index 050e1a3..f8d7231 100644
--- a/lib/VNLib.Data.Caching.Extensions/src/VNCacheClusterClient.cs
+++ b/lib/VNLib.Data.Caching.Extensions/src/VNCacheClusterClient.cs
@@ -46,7 +46,6 @@ namespace VNLib.Data.Caching.Extensions
/// <summary>
/// Connects to the specified server on the configured cache client
/// </summary>
- /// <param name="factory"></param>
/// <param name="server">The server to connect to</param>
/// <param name="token">A token to cancel the operation</param>
/// <returns>A task that resolves when the client is connected to the cache server</returns>
diff --git a/plugins/VNLib.Data.Caching.Providers.VNCache/src/AddOrUpdateBuffer.cs b/plugins/VNLib.Data.Caching.Providers.VNCache/src/AddOrUpdateBuffer.cs
index cf3cf63..5a61604 100644
--- a/plugins/VNLib.Data.Caching.Providers.VNCache/src/AddOrUpdateBuffer.cs
+++ b/plugins/VNLib.Data.Caching.Providers.VNCache/src/AddOrUpdateBuffer.cs
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2023 Vaughn Nugent
+* Copyright (c) 2024 Vaughn Nugent
*
* Library: VNLib
* Package: VNLib.Data.Caching.Providers.VNCache
@@ -36,17 +36,11 @@ namespace VNLib.Data.Caching.Providers.VNCache
/// store the object data for use by the memory cache store, and the
/// remote cache store
/// </summary>
- internal sealed class AddOrUpdateBuffer : VnDisposeable, IBufferWriter<byte>, IObjectData
+ internal sealed class AddOrUpdateBuffer(IUnmangedHeap heap) : VnDisposeable, IBufferWriter<byte>, IObjectData
{
private int _count;
- private readonly IUnmangedHeap _heap;
private MemoryHandle<byte>? _buffer;
- public AddOrUpdateBuffer(IUnmangedHeap heap)
- {
- _heap = heap;
- }
-
///<inheritdoc/>
public void Advance(int count)
{
@@ -55,13 +49,13 @@ namespace VNLib.Data.Caching.Providers.VNCache
}
///<inheritdoc/>
- Memory<byte> IBufferWriter<byte>.GetMemory(int sizeHint = 0)
+ Memory<byte> IBufferWriter<byte>.GetMemory(int sizeHint)
{
throw new NotImplementedException();
}
///<inheritdoc/>
- Span<byte> IBufferWriter<byte>.GetSpan(int sizeHint = 0)
+ Span<byte> IBufferWriter<byte>.GetSpan(int sizeHint)
{
//Round to nearest page for new size
nint newSize = MemoryUtil.NearestPage(sizeHint + _count);
@@ -69,11 +63,11 @@ namespace VNLib.Data.Caching.Providers.VNCache
//Alloc buffer it not yet allocated
if (_buffer == null)
{
- _buffer = _heap.Alloc<byte>(newSize);
+ _buffer = MemoryUtil.SafeAlloc<byte>(heap, newSize, false);
}
else
{
- //check for resize if allocated
+ //check for resize if already allocated
_buffer.ResizeIfSmaller(newSize);
}