MCPcopy Create free account
hub / github.com/Tencent/MMKV / getExpireTimeForKey

Method getExpireTimeForKey

Core/MMKV_IO.cpp:1959–1982  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1957}
1958
1959uint32_t MMKV::getExpireTimeForKey(MMKVKey_t key) {
1960 SCOPED_LOCK(m_lock);
1961 SCOPED_LOCK(m_sharedProcessLock);
1962 checkLoadData();
1963
1964 if (!m_enableKeyExpire || mmkv_key_length(key) == 0) {
1965 return 0;
1966 }
1967 auto raw = getRawDataForKey(key);
1968 assert(raw.length() == 0 || raw.length() >= Fixed32Size);
1969 if (raw.length() < Fixed32Size) {
1970 if (raw.length() != 0) {
1971#ifdef MMKV_APPLE
1972 MMKVWarning("key [%@] has invalid value size %u", key, raw.length());
1973#else
1974 MMKVWarning("key [%s] has invalid value size %u", key.data(), raw.length());
1975#endif
1976 }
1977 return 0;
1978 }
1979 auto ptr = (const uint8_t *) raw.getPtr() + raw.length() - Fixed32Size;
1980 auto time = *(const uint32_t *) ptr;
1981 return time;
1982}
1983
1984mmkv::MMBuffer MMKV::getDataWithoutMTimeForKey(MMKVKey_t key) {
1985 SCOPED_LOCK(m_lock);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected