| 2751 | } |
| 2752 | |
| 2753 | void redisDbPersistentData::setExpire(robj *key, robj *subkey, long long when) |
| 2754 | { |
| 2755 | /* Reuse the sds from the main dict in the expire dict */ |
| 2756 | dictEntry *kde = dictFind(m_pdict,ptrFromObj(key)); |
| 2757 | serverAssertWithInfo(NULL,key,kde != NULL); |
| 2758 | trackkey(key, true /* fUpdate */); |
| 2759 | |
| 2760 | robj *o = (robj*)dictGetVal(kde); |
| 2761 | if (o->getrefcount(std::memory_order_relaxed) == OBJ_SHARED_REFCOUNT) |
| 2762 | { |
| 2763 | // shared objects cannot have the expire bit set, create a real object |
| 2764 | dictSetVal(m_pdict, kde, dupStringObject(o)); |
| 2765 | o = (robj*)dictGetVal(kde); |
| 2766 | } |
| 2767 | |
| 2768 | const char *szSubKey = (subkey != nullptr) ? szFromObj(subkey) : nullptr; |
| 2769 | if (o->FExpires()) { |
| 2770 | o->expire.update(szSubKey, when); |
| 2771 | } |
| 2772 | else |
| 2773 | { |
| 2774 | expireEntry e(szSubKey, when); |
| 2775 | o->expire = std::move(e); |
| 2776 | o->SetFExpires(true); |
| 2777 | ++m_numexpires; |
| 2778 | } |
| 2779 | } |
| 2780 | |
| 2781 | void redisDbPersistentData::setExpire(const char *key, expireEntry &&e) |
| 2782 | { |
no test coverage detected