> For the complete documentation index, see [llms.txt](https://docs.acpt.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acpt.io/developers/functions/flush_acpt_caches.md).

# flush\_acpt\_caches

Clean caches and fire the hook after a bulk write is committed (Public API, level 1)

Run the side effects of a bulk write **after** your transaction is committed: clean the object cache of each touched post, flush ACPT's own caches, and fire [`acpt/bulk_saved_meta_values`](https://docs.acpt.io/developers/actions/acpt-bulk_saved_meta_values.md). Part of the [Public API](https://docs.acpt.io/developers/public-api.md) (level 1, ACPT 2.1.10+).

[`bulk_save_acpt_meta_field_values`](https://docs.acpt.io/developers/functions/bulk_save_acpt_meta_field_values.md) and [`save_acpt_meta_group_definition`](https://docs.acpt.io/developers/functions/save_acpt_meta_group_definition.md) do none of this themselves, so that nothing sees values you later roll back. If you never call `flush_acpt_caches`, listeners never hear about your write.

### Usage

```php
$wpdb->query('COMMIT');

// only the IDs of the posts whose rows were saved
flush_acpt_caches(['post' => [12, 13]]);
```

### Parameters

| Parameter | Type  | Required | Description                                                                                                      |
| --------- | ----- | -------- | ---------------------------------------------------------------------------------------------------------------- |
| `touched` | array | Optional | `['post' => [ids]]`: the posts that were written. IDs are deduplicated and cast to int; unknown keys are ignored |

### Return

Nothing (`void`).

### Notes

* The action fires once, and only when at least one post ID remains.
* It is safe to call more than once. If your import can crash between the commit and this call, call it again for the last committed batch when the import resumes.
* Never call it inside your transaction.
