void genhash_free(genhash_t* h) { if(h != NULL) { genhash_clear(h); free(h); } }
static ENGINE_ERROR_CODE mock_flush(ENGINE_HANDLE* handle, const void* cookie, time_t when) { (void)cookie; (void)when; genhash_clear(get_ht(handle)); return ENGINE_SUCCESS; }
static void test_clear() { genhash_t* h=get_test_hash(); assert(genhash_size(h) == 26); genhash_clear(h); assert(genhash_size(h) == 0); genhash_free(h); }
void mcache_flush_all(mcache *m, uint32_t msec_exp) { if (m == NULL) { return; } if (m->lock) { cb_mutex_enter(m->lock); } if (m->map != NULL) { genhash_clear(m->map); m->lru_head = NULL; m->lru_tail = NULL; m->oldest_live = msec_exp; } if (m->lock) { cb_mutex_exit(m->lock); } }