You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For serialize, RedisValue accepts ReadOnlyMemory so we can write the following.
publicTask<bool>async SetAsync<T>(Tvalue,TimeSpan?expiry=null,Whenwhen=When.Always,CommandFlagsflags=CommandFlags.None){// ArrayBufferWriter is only for .NET Core 3.0 and it creates new T[]// create similar code that uses ArrayPool<byte>.Shared.Rentusing(varbufferWriter=newArrayBufferWriter<byte>()){MessagePackSerializer.Serialize(bufferWriter,value);RedisValueserialized=bufferWriter.WrittenMemory;returnawaitthis.Connection.Database.StringSetAsync(this.Key,serialized,expiry,when,flags);}}
The text was updated successfully, but these errors were encountered:
StachExchange.Redis 2.x has new lease APIs.
It can avoid
byte[]
allocation in deserialize.For serialize, RedisValue accepts ReadOnlyMemory so we can write the following.
The text was updated successfully, but these errors were encountered: