protected override IMemcachedRequest CreateRequest() { var builder = new BinaryRequestBuilder(allocator, 0) { Operation = OpCode.Stat }; try { if (!String.IsNullOrEmpty(type)) { using var data = allocator.Rent(type.Length); var span = data.Memory.Span; var count = Encoding.ASCII.GetBytes(type.AsSpan(), span); builder.SetKeyRaw(span.Take(count)); } builder.Commit(); } catch { builder.Dispose(); throw; } return(builder); }
protected BinaryItemOperation(MemoryPool <byte> allocator, string key, IKeyFormatter keyFormatter, byte extraLength = 0) { Allocator = allocator; try { Request = new BinaryRequestBuilder(allocator, extraLength); Key = Request.SetKey(keyFormatter, key); } catch { Request?.Dispose(); throw; } }