本文整理汇总了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 ;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例8: freeZsetObject
void freeZsetObject(robj *o) {
zset *zs = o->ptr;
dictRelease(zs->dict);
zslFree(zs->zsl);
zfree(zs);
}
示例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);
}
示例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);
}
示例11: deallocStaticFile
void deallocStaticFile()
{
if (AllowExtensions)
dictRelease(AllowExtensions);
if (DirectoryIndex)
freeList(DirectoryIndex);
MaxFileSize = 0;
wstrFree(IfModifiedSince);
}
示例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;
}
示例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);
}
示例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);
}
示例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");
}
}