* remove_cache_entry * Remove 'entry' from the cache and free memory used by it. */
| 344 | * Remove 'entry' from the cache and free memory used by it. |
| 345 | */ |
| 346 | static void |
| 347 | remove_cache_entry(MemoizeState *mstate, MemoizeEntry *entry) |
| 348 | { |
| 349 | MemoizeKey *key = entry->key; |
| 350 | |
| 351 | dlist_delete(&entry->key->lru_node); |
| 352 | |
| 353 | /* Remove all of the tuples from this entry */ |
| 354 | entry_purge_tuples(mstate, entry); |
| 355 | |
| 356 | /* |
| 357 | * Update memory accounting. entry_purge_tuples should have already |
| 358 | * subtracted the memory used for each cached tuple. Here we just update |
| 359 | * the amount used by the entry itself. |
| 360 | */ |
| 361 | mstate->mem_used -= EMPTY_ENTRY_MEMORY_BYTES(entry); |
| 362 | |
| 363 | /* Remove the entry from the cache */ |
| 364 | memoize_delete_item(mstate->hashtable, entry); |
| 365 | |
| 366 | pfree(key->params); |
| 367 | pfree(key); |
| 368 | } |
| 369 | |
| 370 | /* |
| 371 | * cache_purge_all |
no test coverage detected