Return a random key from the keyspace
Returns a random key from the currently selected database.
Search the reference...
/
method
Return a random key from the keyspace
Returns a random key from the currently selected database.
Promise that resolves with a random key name, or null if the database is empty
await redis.set("key1", "value1");
await redis.set("key2", "value2");
await redis.set("key3", "value3");
const randomKey = await redis.randomkey();
console.log(randomKey); // One of: "key1", "key2", or "key3"
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →