#1395·sled

Functionality to check if a key is present in cache

Author: Frederik-BaetensCreated Feb 10, 2022Updated Jun 23, 2025
Labelsfeature

I understand from #1123 that sled can be much more performant by not using async, and it's users likely could be too. However, a lot of users are forced into using async by the libraries (e.g. RPC with tonic) they're using. For those using async, and a database too large to fit into memory, it would be convenient if there were a method to check if a key is present in the cache, so they can avoid calling spawn_blocking in that case.

Or are there better patterns async users can use when their dataset doesn't fit into memory? Would just using spawn_blocking all the time incur negligible performance costs?

Use Case:

Avoiding some of the spawn_blocking calls currently needed when using sled with async

Proposed Change:

Method to check if a key is present in the cache

Who Benefits From The Change(s)?

Async users

Alternative Approaches

Async wrappers around sled's operations, so no operation is blocking in the first place