diff options
author | vnugent <public@vaughnnugent.com> | 2024-06-21 17:07:01 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-06-21 17:07:01 -0400 |
commit | 2bfa3f2724ba762cf0b88de2d1acf119f5ce46c2 (patch) | |
tree | acd03c866087b96fe0ed5c2b6a5a8a319d9dc9e6 /lib | |
parent | b21ee53a99b30a21cecd1687ca337d713c919877 (diff) |
latest server changes + better validation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNLib.Data.Caching.ObjectCache/src/BlobCacheTable.cs | 15 |
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; |