예제 #1
0
        public static T To <T>(this RedisString value)
        {
            switch (value)
            {
            case RedisByteString byteValue:
                return(byteValue.To <T>());

            case RedisCharString charValue:
                return(charValue.To <T>());

            default:
                throw new NotImplementedException();
            }
        }
예제 #2
0
        private static void WriteString(PipeWriter writer, RedisString value)
        {
            var buffer = writer.GetMemory(value.ByteLength);

            if (value is RedisByteString byteValue)
            {
                byteValue.Value.CopyTo(buffer);
            }
            else
            {
                var charValue = (RedisCharString)value;
                Encoding.GetBytes(charValue.Value, buffer.Span);
            }

            writer.Advance(value.ByteLength);
        }