@@ -225,11 +225,24 @@ public void Put(byte[] key, byte[] value, ColumnFamilyHandle cf = null, WriteOpt
225225 {
226226 Put ( key , key . GetLongLength ( 0 ) , value , value . GetLongLength ( 0 ) , cf , writeOptions ) ;
227227 }
228+
229+ public void Put ( Span < byte > key , Span < byte > value , ColumnFamilyHandle cf = null , WriteOptions writeOptions = null )
230+ {
231+ Put ( key , key . Length , value , value . Length , cf , writeOptions ) ;
232+ }
228233
229234 public void Put ( byte [ ] key , long keyLength , byte [ ] value , long valueLength , ColumnFamilyHandle cf = null , WriteOptions writeOptions = null )
230235 {
231236 Native . Instance . rocksdb_put ( Handle , ( writeOptions ?? DefaultWriteOptions ) . Handle , key , keyLength , value , valueLength , cf ) ;
232237 }
238+
239+ public unsafe void Put ( Span < byte > key , long keyLength , Span < byte > value , long valueLength , ColumnFamilyHandle cf = null , WriteOptions writeOptions = null )
240+ {
241+ fixed ( byte * keyPtr = & MemoryMarshal . GetReference ( key ) , valuePtr = & MemoryMarshal . GetReference ( value ) )
242+ {
243+ Native . Instance . rocksdb_put ( Handle , ( writeOptions ?? DefaultWriteOptions ) . Handle , keyPtr , keyLength , valuePtr , valueLength , cf ) ;
244+ }
245+ }
233246
234247 public Iterator NewIterator ( ColumnFamilyHandle cf = null , ReadOptions readOptions = null )
235248 {
0 commit comments