当前位置: 首页>>代码示例>>C++>>正文


C++ dictRelease函数代码示例

本文整理汇总了C++中dictRelease函数的典型用法代码示例。如果您正苦于以下问题:C++ dictRelease函数的具体用法?C++ dictRelease怎么用?C++ dictRelease使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dictRelease函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: destroyDM

void __exit destroyDM()
{
	destroyCFSThread();
	dictRelease(g_dataModel.cfsHashTable);
	dictRelease(g_cfmDict);
	return ;
}
开发者ID:yuandaxing,项目名称:c-cassandra,代码行数:7,代码来源:dataModel.c

示例2: initDbEngine

int initDbEngine(void)
{
    objectIndexLength = 256;
    objectIndexFreeId = 0;
    objectIndexCount = 0;
    if (NULL == (objectIndex = (const dbObject **) calloc(objectIndexLength, (sizeof(const dbObject *)))))
        return -1;

    if (NULL == (sets = dictCreate(&dictSetType, NULL)))
    {
        free((void *) objectIndex);
        return -1;
    }

    if (0 != registerSyncObject(sets))
    {
        free((void *) objectIndex);
        dictRelease(sets);
        return -1;
    }

    if (0 != registerSyncObject(objectIndex))
    {
        unregisterSyncObject(sets);
        free((void *) objectIndex);
        dictRelease(sets);
        return -1;
    }

    return 0;
}
开发者ID:aquirel,项目名称:athenadb,代码行数:31,代码来源:dbengine.c

示例3: cowBkgdSaveReset

/* release memory allocated for copy on write during background save */
void cowBkgdSaveReset() {
    int j;
    listNode *ln;

    if (server.cowDictCopied != NULL) {
        for (j = 0; j < server.dbnum; j++) {
            if (server.cowSaveDb[j].dict != NULL) {
                /* restore normal dictionary destructors */
                restore_dictobj(server.db[j].dict, &server.cowSaveDbExt[j]);
                server.cowSaveDb[j].dict = NULL;
            }

            if (server.cowSaveDbExt[j].dictArray != NULL) {
                cowReleaseDictArray(server.cowSaveDbExt[j].dictArray);
                server.cowSaveDbExt[j].dictArray = NULL;
            }

            if (server.cowSaveDb[j].expires != NULL &&
                server.cowSaveDb[j].expires != server.db[j].expires) {
                dictRelease(server.cowSaveDb[j].expires);
                server.cowSaveDb[j].expires = NULL;
            }
        }
    }

    server.cowCurIters.curDbDictIter = NULL;
    server.cowCurIters.curObjDictIter = NULL;
    server.cowCurIters.curObjZDictIter = NULL;
    server.cowCurIters.curObjListIter = NULL;

    /* cleanup table of copied items */
    if (server.cowDictCopied != NULL) {
        dictRelease(server.cowDictCopied);
        server.cowDictCopied = NULL;
    }

    if (server.cowDictConverted != NULL) {
        dictRelease(server.cowDictConverted);
        server.cowDictConverted = NULL;
    }

    /* delete all deferred items */
    redisLog(REDIS_NOTICE, "cowBkgdSaveReset deleting %d SDS and %d obj items",
                listLength(deferSdsDelete), listLength(deferObjDelete));
    while ( (ln = listFirst(deferSdsDelete)) != NULL) {
        sdsfree((sds)(ln->value));
        listDelNode(deferSdsDelete, ln);
    }
    while ( (ln = listFirst(deferObjDelete)) != NULL) {
        if (ln->value != NULL) {
            decrRefCount(ln->value);
        }
        listDelNode(deferObjDelete, ln);
    }
}
开发者ID:lrascao,项目名称:redis,代码行数:56,代码来源:win32_cow.c

示例4: __redisAsyncFree

/* Helper function to free the context. */
static void __redisAsyncFree(redisAsyncContext *ac) {
    redisContext *c = &(ac->c);
    redisCallback cb;
    dictIterator *it;
    dictEntry *de;

    // 执行所有等待队列中回调函数,将空回复传进去
    /* Execute pending callbacks with NULL reply. */
    while (__redisShiftCallback(&ac->replies,&cb) == REDIS_OK)
        __redisRunCallback(ac,&cb,NULL);

    // 执行所有等待队列中回调函数,将空回复传进去
    // 这里是无效命令的回调函数
    /* Execute callbacks for invalid commands */
    while (__redisShiftCallback(&ac->sub.invalid,&cb) == REDIS_OK)
        __redisRunCallback(ac,&cb,NULL);

    // 执行所有等待队列中回调函数,将空回复传进去
    // 这里是订阅发布的回调函数
    /* Run subscription callbacks callbacks with NULL reply */
    it = dictGetIterator(ac->sub.channels);
    while ((de = dictNext(it)) != NULL)
        __redisRunCallback(ac,dictGetEntryVal(de),NULL);
    dictReleaseIterator(it);
    dictRelease(ac->sub.channels);

    // 执行所有等待队列中回调函数,将空回复传进去
    // 这里是订阅发布的回调函数
    it = dictGetIterator(ac->sub.patterns);
    while ((de = dictNext(it)) != NULL)
        __redisRunCallback(ac,dictGetEntryVal(de),NULL);
    dictReleaseIterator(it);
    dictRelease(ac->sub.patterns);

    // 注销连接上的读写事件
    /* Signal event lib to clean up */
    _EL_CLEANUP(ac);

    // 执行连接关闭回调函数,可做一些清理工作
    /* Execute disconnect callback. When redisAsyncFree() initiated destroying
     * this context, the status will always be REDIS_OK. */
    if (ac->onDisconnect && (c->flags & REDIS_CONNECTED)) {
        if (c->flags & REDIS_FREEING) {
            ac->onDisconnect(ac,REDIS_OK);
        } else {
            ac->onDisconnect(ac,(ac->err == 0) ? REDIS_OK : REDIS_ERR);
        }
    }

    // 释放 redisContext 中的内存
    /* Cleanup self */
    redisFree(c);
}
开发者ID:daoluan,项目名称:decode-redis-2.8,代码行数:54,代码来源:async.c

示例5: scriptingRelease

/* Release resources related to Lua scripting.
 * 释放 Lua 脚本的相关资源
 * This function is used in order to reset the scripting environment.
 * 用于初始化脚本环境
 */
void scriptingRelease(void)
{
    // 释放记录脚本的字典
    dictRelease(server.lua_scripts);
    // 关闭 Lua 环境
    lua_close(server.lua);
}
开发者ID:jiangguang5201314,项目名称:ZNginx,代码行数:12,代码来源:scripting.c

示例6: dictCounterDestructor

void dictCounterDestructor(void *privdata, void *val) {
    DICT_NOTUSED(privdata);
    listNode *ln;
    listIter li;
    counter *cntr = val;
    pubsub *p;

    /* Unsubscribe everyone */
    if (cntr->subscribers != NULL) {
        while (listLength(cntr->subscribers)) {
            ln = listFirst(cntr->subscribers);
            p  = listNodeValue(ln);
            pubsubUnsubscribeCounter(p->c,cntr->name,1);
        }
    }

    /* Free all shards */
    listRewind(cntr->shards,&li);
    while ((ln = listNext(&li)) != NULL) {
        shard *shrd = listNodeValue(ln);
        zfree(shrd);
    }

    listRelease(cntr->shards);
    if (cntr->want_acks) dictRelease(cntr->want_acks);

    /* cntr->name will be freed by the dict code. */

    zfree(cntr);
}
开发者ID:erikdubbelboer,项目名称:discnt,代码行数:30,代码来源:counter.c

示例7: main

int main(int argc, char *argv[]) 
{
    int ret;
    dict *d = dictCreate(&testDictType, NULL);
    assert(d);
    Key_t *k = (Key_t*)malloc(sizeof(*k)); 
    k->laddr = 112;
    k->raddr = 112;
    k->lport = 1123;
    k->rport = 3306;

    Val_t *v = (Val_t*)malloc(sizeof(*v)); 
    v->v = malloc(100);
    snprintf(v->v, 100, "%s", "abcdefg");
    
    ret = dictAdd(d, k, v);
    assert(ret == DICT_OK);

    Val_t *v2 = dictFetchValue(d, k);

    assert(0 == strcmp(v2->v, v->v));

    printf("%d-%s-%s\n", ret, v->v, v2->v);

    dictPrintStats(d);

    dictDelete(d, k);

    dictPrintStats(d);

    dictRelease(d);

    return 0;
}
开发者ID:AMCScarface,项目名称:misc,代码行数:34,代码来源:hash.c

示例8: freeZsetObject

void freeZsetObject(robj *o) {
    zset *zs = o->ptr;

    dictRelease(zs->dict);
    zslFree(zs->zsl);
    zfree(zs);
}
开发者ID:tjweir,项目名称:redis,代码行数:7,代码来源:object.c

示例9: engine_free

void
engine_free(Engine *engine) {
  dictRelease(engine->queries);
  if(engine->data_dir) {
    pstring_free(engine->data_dir);
  }
  parser_free(engine->parser);
  ring_buffer_free(engine->stream);
  if(engine->auth) pstring_free(engine->auth);
  lrw_dict_free(engine->term_dictionary);
  plist_pool_free(engine->postings);
  if(engine->docs->on_evict)callback_free(engine->docs->on_evict);
  ring_buffer_free(engine->docs);
  dictRelease(engine->ints);
  if(engine->doc_set) dictRelease(engine->doc_set);
  free(engine);
}
开发者ID:fizx,项目名称:sit,代码行数:17,代码来源:engine.c

示例10: cmd_mgr_destroy

void
cmd_mgr_destroy (command_manager * mgr)
{
  aeDeleteTimeEvent (mgr->el, mgr->cron_teid);
  dictRelease (mgr->commands);
  index_helper_destroy (mgr->idx_helper);
  mempool_destroy (mgr->mp_cmdctx);
  zfree (mgr);
}
开发者ID:LichKing-lee,项目名称:nbase-arc,代码行数:9,代码来源:gw_cmd_mgr.c

示例11: deallocStaticFile

void deallocStaticFile()
{
    if (AllowExtensions)
        dictRelease(AllowExtensions);
    if (DirectoryIndex)
        freeList(DirectoryIndex);
    MaxFileSize = 0;
    wstrFree(IfModifiedSince);
}
开发者ID:alemic,项目名称:wheatserver,代码行数:9,代码来源:app_static_file.c

示例12: main

int main(int argc, const char *argv[])
{
    struct timeval start, end;
    double elapsed;
    dict *d;
    struct bftree *tree;
    const int times = 500;

    struct bftree_opts opt = {
        NULL, NULL, bftreeSdsKeyCompare, (void (*)(void*))sdsfree, (void (*)(void*))sdsfree
    };
    tree = bftree_create(&opt);

    d = dictCreate(&sdsdict_type, NULL);

    gettimeofday(&start, NULL);
    redis_add(d, times);
    gettimeofday(&end, NULL);
    elapsed = get_seconds(start, end);
    printf("redis add %d elements seconds: %f\n", times, elapsed);

    gettimeofday(&start, NULL);
    tree = bftree_add(tree, times);
    gettimeofday(&end, NULL);
    elapsed = get_seconds(start, end);
    printf("bftree add %d elements seconds: %f\n", times, elapsed);

    gettimeofday(&start, NULL);
    redis_fetch(d, times);
    gettimeofday(&end, NULL);
    elapsed = get_seconds(start, end);
    printf("redis get %d elements seconds: %f\n", times, elapsed);

    gettimeofday(&start, NULL);
    bftree_fetch(tree, times);
    gettimeofday(&end, NULL);
    elapsed = get_seconds(start, end);
    printf("bftree get %d elements seconds: %f\n", times, elapsed);

    gettimeofday(&start, NULL);
    redis_del(d, times);
    gettimeofday(&end, NULL);
    elapsed = get_seconds(start, end);
    printf("redis delete %d elements seconds: %f\n", times, elapsed);

    gettimeofday(&start, NULL);
    bftree_delele(tree, times);
    gettimeofday(&end, NULL);
    elapsed = get_seconds(start, end);
    printf("bftree delete %d elements seconds: %f\n", times, elapsed);

    bftree_free(tree);
    dictRelease(d);

    return 0;
}
开发者ID:PawelMarc,项目名称:C-Buffered-tree,代码行数:56,代码来源:performance.c

示例13: aeDeleteEventLoop

void aeDeleteEventLoop(aeEventLoop *eventLoop) {
    aeApiFree(eventLoop);
#ifdef _WIN32
    dictRelease(eventLoop->fdiMap->map);
    listRelease(eventLoop->fdiMap->recycle_pool);
    zfree(eventLoop->fdiMap);
#endif
    zfree(eventLoop->events);
    zfree(eventLoop->fired);
    zfree(eventLoop);
}
开发者ID:naver,项目名称:nbase-arc,代码行数:11,代码来源:ae.c

示例14: result_iterator_free

void
result_iterator_free(ResultIterator *iter) {
  dictRelease(iter->cursors);
  for(int i = 0; i < iter->count; i++) {
    free(iter->subs[i]->cursors);
    free(iter->subs[i]->negateds);
    free(iter->subs[i]->state);
    free(iter->subs[i]);
  }
  free(iter->subs);
  free(iter);
}
开发者ID:fizx,项目名称:sit,代码行数:12,代码来源:engine.c

示例15: freeSetObject

void freeSetObject(robj *o) {
    switch (o->encoding) {
    case OBJ_ENCODING_HT:
        dictRelease((dict*) o->ptr);
        break;
    case OBJ_ENCODING_INTSET:
        zfree(o->ptr);
        break;
    default:
        serverPanic("Unknown set encoding type");
    }
}
开发者ID:LichKing-lee,项目名称:nbase-arc,代码行数:12,代码来源:object.c


注:本文中的dictRelease函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。