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

Function RM_SelectDb

src/module.cpp:2293–2296  ·  view source on GitHub ↗

Change the currently selected DB. Returns an error if the id * is out of range. * * Note that the client will retain the currently selected DB even after * the Redis command implemented by the module calling this function * returns. * * If the module command wishes to change something in a different DB and * returns back to the original one, it should call RedisModule_GetSelectedDb() * be

Source from the content-addressed store, hash-verified

2291 * returns back to the original one, it should call RedisModule_GetSelectedDb()
2292 * before in order to restore the old DB number before returning. */
2293int RM_SelectDb(RedisModuleCtx *ctx, int newid) {
2294 int retval = selectDb(ctx->client,newid);
2295 return (retval == C_OK) ? REDISMODULE_OK : REDISMODULE_ERR;
2296}
2297
2298/* Initialize a RedisModuleKey struct */
2299static void moduleInitKey(RedisModuleKey *kp, RedisModuleCtx *ctx, robj *keyname, robj *value, int mode){

Callers

nothing calls this directly

Calls 1

selectDbFunction · 0.85

Tested by

no test coverage detected