aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-06-21 17:07:01 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-06-21 17:07:01 -0400
commit2bfa3f2724ba762cf0b88de2d1acf119f5ce46c2 (patch)
treeacd03c866087b96fe0ed5c2b6a5a8a319d9dc9e6 /lib
parentb21ee53a99b30a21cecd1687ca337d713c919877 (diff)
latest server changes + better validation
Diffstat (limited to 'lib')
-rw-r--r--lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs b/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs
index 789448d..c6cc8fc 100644
--- a/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs
+++ b/lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs
@@ -104,13 +104,14 @@ namespace VNLib.Data.Caching.ObjectCache
{
ArgumentOutOfRangeException.ThrowIfLessThan(objectId.Length, 4, nameof(objectId));
- Span<byte> buffer = stackalloc byte[4];
-
- //cast the characters
- buffer[0] = (byte)objectId[0];
- buffer[1] = (byte)objectId[objectId.Length / 2];
- buffer[2] = (byte)objectId[1];
- buffer[3] = (byte)objectId[^1];
+ Span<byte> buffer =
+ [
+ //cast the characters
+ (byte)objectId[0],
+ (byte)objectId[objectId.Length / 2],
+ (byte)objectId[1],
+ (byte)objectId[^1],
+ ];
//Read the buffer back to a uint and mod by the table size to get the bucket index
return BitConverter.ToUInt32(buffer) % _tableSize;