MCPcopy Create free account
hub / github.com/F-Stack/f-stack / createObject

Function createObject

app/redis-6.2.6/src/object.c:41–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39/* ===================== Creation and parsing of objects ==================== */
40
41robj *createObject(int type, void *ptr) {
42 robj *o = zmalloc(sizeof(*o));
43 o->type = type;
44 o->encoding = OBJ_ENCODING_RAW;
45 o->ptr = ptr;
46 o->refcount = 1;
47
48 /* Set the LRU to the current lruclock (minutes resolution), or
49 * alternatively the LFU counter. */
50 if (server.maxmemory_policy & MAXMEMORY_FLAG_LFU) {
51 o->lru = (LFUGetTimeInMinutes()<<8) | LFU_INIT_VAL;
52 } else {
53 o->lru = LRU_CLOCK();
54 }
55 return o;
56}
57
58/* Set a special refcount in the object to make it "shared":
59 * incrRefCount and decrRefCount() will test for this special refcount

Callers 15

hashTypeDupFunction · 0.85
replicationFeedSlavesFunction · 0.85
replicationFeedMonitorsFunction · 0.85
notifyKeyspaceEventFunction · 0.85
geoaddCommandFunction · 0.85
setrangeCommandFunction · 0.85
slowlogCreateEntryFunction · 0.85
bitopCommandFunction · 0.85
createHLLObjectFunction · 0.85
createSharedObjectsFunction · 0.85
rdbLoadIntegerObjectFunction · 0.85

Calls 3

zmallocFunction · 0.85
LFUGetTimeInMinutesFunction · 0.85
LRU_CLOCKFunction · 0.85

Tested by

no test coverage detected