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

Method removeSubkeyExpire

src/db.cpp:1830–1858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1828}
1829
1830int redisDbPersistentData::removeSubkeyExpire(robj *key, robj *subkey) {
1831 auto de = find(szFromObj(key));
1832 serverAssertWithInfo(NULL,key,de != nullptr);
1833
1834 robj *val = de.val();
1835 if (!val->FExpires())
1836 return 0;
1837
1838 if (!val->expire.FFat())
1839 return 0;
1840
1841 int found = 0;
1842 for (auto subitr : val->expire)
1843 {
1844 if (subitr.subkey() == nullptr)
1845 continue;
1846 if (sdscmp((sds)subitr.subkey(), szFromObj(subkey)) == 0)
1847 {
1848 val->expire.erase(subitr);
1849 found = 1;
1850 break;
1851 }
1852 }
1853
1854 if (val->expire.pfatentry()->size() == 0)
1855 this->removeExpire(key, de);
1856
1857 return found;
1858}
1859
1860/* Set an expire to the specified key. If the expire is set in the context
1861 * of an user calling a command 'c' is the client, otherwise 'c' is set

Callers 1

persistCommandFunction · 0.80

Calls 10

removeExpireMethod · 0.95
szFromObjFunction · 0.85
sdscmpFunction · 0.85
FExpiresMethod · 0.80
FFatMethod · 0.80
subkeyMethod · 0.80
pfatentryMethod · 0.80
valMethod · 0.45
eraseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected