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

Function saveKey

src/rdb.cpp:1240–1263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1238}
1239
1240int saveKey(rio *rdb, int flags, size_t *processed, const char *keystr, robj_roptr o)
1241{
1242 redisObjectStack key;
1243
1244 initStaticStringObject(key,(char*)keystr);
1245 const expireEntry *pexpire = nullptr;
1246 if (o->FExpires()) {
1247 pexpire = &o->expire;
1248 }
1249
1250 if (rdbSaveKeyValuePair(rdb,&key,o,pexpire) == -1)
1251 return 0;
1252
1253 /* When this RDB is produced as part of an AOF rewrite, move
1254 * accumulated diff from parent to child while rewriting in
1255 * order to have a smaller final write. */
1256 if (flags & RDBFLAGS_AOF_PREAMBLE &&
1257 rdb->processed_bytes > *processed+AOF_READ_DIFF_INTERVAL_BYTES)
1258 {
1259 *processed = rdb->processed_bytes;
1260 aofReadDiffFromParent();
1261 }
1262 return 1;
1263}
1264
1265ssize_t rdbSaveSingleModuleAux(rio *rdb, int when, moduleType *mt) {
1266 /* Save a module-specific aux value. */

Callers 1

rdbSaveRioFunction · 0.85

Calls 3

rdbSaveKeyValuePairFunction · 0.85
aofReadDiffFromParentFunction · 0.85
FExpiresMethod · 0.80

Tested by

no test coverage detected