MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / RM_RandomKey

Function RM_RandomKey

src/module.cpp:2524–2528  ·  view source on GitHub ↗

Returns a name of a random key, or NULL if current db is empty. */

Source from the content-addressed store, hash-verified

2522
2523/* Returns a name of a random key, or NULL if current db is empty. */
2524RedisModuleString *RM_RandomKey(RedisModuleCtx *ctx) {
2525 robj *key = dbRandomKey(ctx->client->db);
2526 autoMemoryAdd(ctx,REDISMODULE_AM_STRING,key);
2527 return key;
2528}
2529
2530/* --------------------------------------------------------------------------
2531 * ## Key API for String type

Callers

nothing calls this directly

Calls 2

dbRandomKeyFunction · 0.85
autoMemoryAddFunction · 0.85

Tested by

no test coverage detected