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

Function RM_SaveString

src/module.cpp:4810–4824  ·  view source on GitHub ↗

In the context of the rdb_save method of a module type, saves a * string into the RDB file taking as input a RedisModuleString. * * The string can be later loaded with RedisModule_LoadString() or * other Load family functions expecting a serialized string inside * the RDB file. */

Source from the content-addressed store, hash-verified

4808 * other Load family functions expecting a serialized string inside
4809 * the RDB file. */
4810void RM_SaveString(RedisModuleIO *io, RedisModuleString *s) {
4811 if (io->error) return;
4812 /* Save opcode. */
4813 ssize_t retval = rdbSaveLen(io->prio, RDB_MODULE_OPCODE_STRING);
4814 if (retval == -1) goto saveerr;
4815 io->bytes += retval;
4816 /* Save value. */
4817 retval = rdbSaveStringObject(io->prio, s);
4818 if (retval == -1) goto saveerr;
4819 io->bytes += retval;
4820 return;
4821
4822saveerr:
4823 io->error = 1;
4824}
4825
4826/* Like RedisModule_SaveString() but takes a raw C pointer and length
4827 * as input. */

Callers

nothing calls this directly

Calls 2

rdbSaveLenFunction · 0.85
rdbSaveStringObjectFunction · 0.85

Tested by

no test coverage detected