aboutsummaryrefslogtreecommitdiff
path: root/lib/VNLib.Data.Caching.ObjectCache/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNLib.Data.Caching.ObjectCache/src')
-rw-r--r--lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs15
-rw-r--r--lib/VNLib.Data.Caching.ObjectCache/src/ICacheEntryMemoryManager.cs8
2 files changed, 8 insertions, 15 deletions
diff --git a/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs b/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs
index 8270f2f..789448d 100644
--- a/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs
+++ b/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2023 Vaughn Nugent
+* Copyright (c) 2024 Vaughn Nugent
*
* Library: VNLib
* Package: VNLib.Data.Caching.ObjectCache
@@ -66,12 +66,8 @@ namespace VNLib.Data.Caching.ObjectCache
/// <exception cref="ArgumentException"></exception>
public BlobCacheTable(uint tableSize, uint bucketSize, ICacheMemoryManagerFactory factory, IPersistantCacheStore? persistantCache)
{
- _ = factory ?? throw new ArgumentNullException(nameof(factory));
-
- if(tableSize == 0)
- {
- throw new ArgumentException("Cache table must have atleast 1 bucket");
- }
+ ArgumentNullException.ThrowIfNull(factory);
+ ArgumentOutOfRangeException.ThrowIfZero(tableSize);
//Init bucket table
_tableSize = tableSize;
@@ -106,10 +102,7 @@ namespace VNLib.Data.Caching.ObjectCache
private uint FastGetBucketIndexFromId(ReadOnlySpan<char> objectId)
{
- if (objectId.Length < 4)
- {
- throw new ArgumentException("Object id must be larger than 3 characters");
- }
+ ArgumentOutOfRangeException.ThrowIfLessThan(objectId.Length, 4, nameof(objectId));
Span<byte> buffer = stackalloc byte[4];
diff --git a/lib/VNLib.Data.Caching.ObjectCache/src/ICacheEntryMemoryManager.cs b/lib/VNLib.Data.Caching.ObjectCache/src/ICacheEntryMemoryManager.cs
index dffbfa2..dd57931 100644
--- a/lib/VNLib.Data.Caching.ObjectCache/src/ICacheEntryMemoryManager.cs
+++ b/lib/VNLib.Data.Caching.ObjectCache/src/ICacheEntryMemoryManager.cs
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2023 Vaughn Nugent
+* Copyright (c) 2024 Vaughn Nugent
*
* Library: VNLib
* Package: VNLib.Data.Caching.ObjectCache
@@ -57,9 +57,9 @@ namespace VNLib.Data.Caching
/// Pins the handle to the specified offset and returns a
/// <see cref="MemoryHandle"/> to the pinned memory block.
/// </summary>
- /// <param name="handle"></param>
- /// <param name="offset"></param>
- /// <returns></returns>
+ /// <param name="handle">A referrence to the existing handle</param>
+ /// <param name="offset">The number of bytes from the base to offset the returned pointer</param>
+ /// <returns>A memory handle pointing to the first byte in the segment given by the offset</returns>
MemoryHandle PinHandle(object handle, int offset);
/// <summary>