Is there an alternative to the exists method that does not increment client_read_not_found / client_read_success?

The exists method seems more of a probe than an actual read, so incrementing read counts is an unexpected side- effect.

Is there either a) another way to mimic the ‘exists’ functionality to not increment the read counts or b) a way to specifically count ‘exists’ read counts so they can be manually subtracted out of the primary counts?

Lacking either of those abilities, is there any advantage of ‘exists’ over just doing a ‘get’ and catching a thrown ‘not found’ exception?

Thank you.

exists() only checks if the primary key is present in RAM. get() will actually go fetch the record from RAM or SSD whatever your storage engine is, after finding the Primary Key in RAM and then locating the record from the address pointer in the Primary Key. So exists() is lot more efficient if that is what you are looking for functionally.

Thank you for your reply.

That makes sense now that you point it out, and so we’d like to continue using ‘exists’.

The downside, then, is that there doesn’t seem to be a way to distinguish the expected ‘fails’ of the exists calls from unexpected fails of get calls. The system should be architected to identify and handle these differently.

I think there’s a general need for such a distinction. It would leave the ‘not found’ count to represent situations where there was truly a problem that needs further investigation (possibly a code or data problem).

You can submit a Feature Request!