Esempio n. 1
0
/* Return the expire time of the specified key, or -1 if no expire
 * is associated with this key (i.e. the key is non volatile) */
long long getExpire(redisDb *db, robj *key) {
    dictEntry *de;

    /* No expire? return ASAP */
    if (dictSize(db->expires) == 0 ||
       (de = dictFind(db->expires,key->ptr)) == NULL) return -1;

    /* The entry was found in the expire dict, this means it should also
     * be present in the main dict (safety check). */
    redisAssertWithInfo(NULL,key,dictFind(db->dict,key->ptr) != NULL);
    return dictGetSignedIntegerVal(de);
}
Esempio n. 2
0
File: engine.c Progetto: fizx/sit
void
_engine_apply_ints(Engine *engine, DocBuf *buffer, long doc_id) {  
  dictIterator *iter = dictGetIterator(engine->ints);
  dictEntry *entry;
  while ((entry = dictNext(iter))) {
    pstring *key = dictGetKey(entry);
    engine_set_int(engine, doc_id, key, 0);
  }
  dictReleaseIterator(iter);
  iter = dictGetIterator(buffer->ints);
  while ((entry = dictNext(iter))) {
    pstring *key = dictGetKey(entry);
    int val = dictGetSignedIntegerVal(entry);
    engine_set_int(engine, doc_id, key, val);
  }
  dictReleaseIterator(iter);
}