imap_gc

Clears IMAP cache

&reftitle.description; `true` `imap_gc` `IMAP\Connection` `imap` `int` `flags`

Purges the cache of entries of a specific type.

&reftitle.parameters;

&imap.imap-parameter.imap;

`flags`

- Specifies the cache to purge. It may one or a combination of the following constants: `IMAP_GC_ELT` (message cache elements), `IMAP_GC_ENV` (envelope and bodies), `IMAP_GC_TEXTS` (texts).

&reftitle.returnvalues;

&return.true.always;

&reftitle.errors;

Throws a `ValueError` if `flags` is invalid.

&reftitle.changelog;

&Version; | &Description;
&imap.changelog.imap-param;
8.0.0 | A `ValueError` is now thrown on invalid `flags` parameter values. Previously, a warning was emitted and the function returned &false;.

&reftitle.examples;

### `imap_gc` example

    <?php

    $mbox = imap_open("{imap.example.org:143}", "username", "password");

    imap_gc($mbox, IMAP_GC_ELT);

    ?>