aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-10-14 15:53:53 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2023-10-14 15:53:53 -0400
commite66bf1e3576f08fa87db8f3a4b6e4cab0531d454 (patch)
tree267aa9b6b676d725b421422df9c52a83a6bf235c
parentd6b453a937a344fcc3d22cdc7e7a9f7d5888e424 (diff)
track vncache serializer updates
-rw-r--r--libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionDataSerialzer.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionDataSerialzer.cs b/libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionDataSerialzer.cs
index 1d83f9c..1cebdf6 100644
--- a/libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionDataSerialzer.cs
+++ b/libs/VNLib.Plugins.Sessions.Cache.Client/src/SessionDataSerialzer.cs
@@ -49,21 +49,21 @@ namespace VNLib.Plugins.Sessions.Cache.Client
CharBufferSize = charBufferSize;
}
- object? ICacheObjectDeserialzer.Deserialze(Type type, ReadOnlySpan<byte> buffer)
+ T? ICacheObjectDeserialzer.Deserialze<T>(ReadOnlySpan<byte> objectData) where T : default
{
- if (!type.IsAssignableTo(typeof(IDictionary<string, string>)))
+ if (!typeof(T).IsAssignableTo(typeof(IDictionary<string, string>)))
{
throw new NotSupportedException("This deserialzer only supports IDictionary<string,string>");
}
//Get char count from bin buffer
- int charCount = Encoding.UTF8.GetCharCount(buffer);
+ int charCount = Encoding.UTF8.GetCharCount(objectData);
//Alloc decode buffer
using UnsafeMemoryHandle<char> charBuffer = MemoryUtil.UnsafeAllocNearestPage<char>(charCount, true);
//decode chars
- Encoding.UTF8.GetChars(buffer, charBuffer.Span);
+ Encoding.UTF8.GetChars(objectData, charBuffer.Span);
//Alloc new dict to write strings to
Dictionary<string, string> output = new(StringComparer.OrdinalIgnoreCase);
@@ -107,7 +107,7 @@ namespace VNLib.Plugins.Sessions.Cache.Client
reader.Advance(sep + 2);
}
- return output;
+ return (T?)(output as object);
}
private static int GetNextToken(ref ForwardOnlyReader<char> reader) => reader.Window.IndexOf(KV_DELIMITER);