From e66bf1e3576f08fa87db8f3a4b6e4cab0531d454 Mon Sep 17 00:00:00 2001 From: vnugent Date: Sat, 14 Oct 2023 15:53:53 -0400 Subject: track vncache serializer updates --- .../src/SessionDataSerialzer.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libs') 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 buffer) + T? ICacheObjectDeserialzer.Deserialze(ReadOnlySpan objectData) where T : default { - if (!type.IsAssignableTo(typeof(IDictionary))) + if (!typeof(T).IsAssignableTo(typeof(IDictionary))) { throw new NotSupportedException("This deserialzer only supports IDictionary"); } //Get char count from bin buffer - int charCount = Encoding.UTF8.GetCharCount(buffer); + int charCount = Encoding.UTF8.GetCharCount(objectData); //Alloc decode buffer using UnsafeMemoryHandle charBuffer = MemoryUtil.UnsafeAllocNearestPage(charCount, true); //decode chars - Encoding.UTF8.GetChars(buffer, charBuffer.Span); + Encoding.UTF8.GetChars(objectData, charBuffer.Span); //Alloc new dict to write strings to Dictionary 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 reader) => reader.Window.IndexOf(KV_DELIMITER); -- cgit