| 1828 | } |
| 1829 | |
| 1830 | int 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 |