Closed danielkornev closed 1 year ago
Hi @danielkornev, from a quick check on your SO question, I think you're missing encoding the key: StringKey will use by default UTF8 encoding, while your code sample seems to be casting an in-memory string to a byte array and then calling the HasKey method:
var charSpan = storageKey.AsSpan();
var byteSpan = MemoryMarshal.Cast<char, byte>(charSpan); <------- this is not converting it to UTF8
Can you try instead to use Encoding.UTF8.GetBytes(key) when reading?
I've posted a question on StackOverflow yesterday regarding this:
https://stackoverflow.com/questions/74257148/how-to-use-rocksdb-to-make-many-concurrent-writes-and-reads-without-database-loo
In general, HasKey only allows one to work with Span while Get and Put methods operate on good ol' strings as well. In any case, checks for HasKey always return "false". Yet if I call Get in
try...catch
I can retrieve most if not all keys. Why is that?