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

Function persistCommand

src/expire.cpp:863–889  ·  view source on GitHub ↗

PERSIST key */

Source from the content-addressed store, hash-verified

861
862/* PERSIST key */
863void persistCommand(client *c) {
864 if (lookupKeyWrite(c->db,c->argv[1])) {
865 if (c->argc == 2) {
866 if (removeExpire(c->db,c->argv[1])) {
867 signalModifiedKey(c,c->db,c->argv[1]);
868 notifyKeyspaceEvent(NOTIFY_GENERIC,"persist",c->argv[1],c->db->id);
869 addReply(c,shared.cone);
870 g_pserver->dirty++;
871 } else {
872 addReply(c,shared.czero);
873 }
874 } else if (c->argc == 3) {
875 if (c->db->removeSubkeyExpire(c->argv[1], c->argv[2])) {
876 signalModifiedKey(c,c->db,c->argv[1]);
877 notifyKeyspaceEvent(NOTIFY_GENERIC,"persist",c->argv[1],c->db->id);
878 addReply(c,shared.cone);
879 g_pserver->dirty++;
880 } else {
881 addReply(c,shared.czero);
882 }
883 } else {
884 addReplyError(c, "Invalid arguments");
885 }
886 } else {
887 addReply(c,shared.czero);
888 }
889}
890
891/* TOUCH key1 [key2 key3 ... keyN] */
892void touchCommand(client *c) {

Callers

nothing calls this directly

Calls 7

lookupKeyWriteFunction · 0.85
removeExpireFunction · 0.85
signalModifiedKeyFunction · 0.85
notifyKeyspaceEventFunction · 0.85
addReplyFunction · 0.85
addReplyErrorFunction · 0.85
removeSubkeyExpireMethod · 0.80

Tested by

no test coverage detected