@@ 43,11 43,14 @@ impl Cache {
redis_conn.set_write_timeout(Some(timeout))?;
redis_conn.set_read_timeout(Some(timeout))?;
}
+ // Scratch wants buffer to already have some size (not just capacity)
+ let mut scratch_buf = BytesMut::with_capacity(1024);
+ scratch_buf.resize(scratch_buf.capacity(), 0);
Ok(Cache {
redis_conn,
// Set up a reasonable allocation - will expand automatically if needed.
store_buf: BytesMut::with_capacity(1024),
- scratch_buf: BytesMut::with_capacity(1024),
+ scratch_buf,
})
}