# Lists

A list is an isolated subset of keys stored in the shared memory of the cache system that can be manipulated at once as a group. For example, you might want store all cached objects related to the user with id `214` in a list named `user_214`, like this:

```php
$userId = 214;
$cacheListName = "user_".$userId;
$e->Cache->huge->listSet($cacheListName, "numberOfVisits", $numberOfVisits);
$e->Cache->huge->listSet($cacheListName, "numberOfFollowers", $numberOfFollowers);
$e->Cache->huge->listSet($cacheListName, "numberOfLikes", $numberOfLikes);
```

Now, when you want to clear the entire cache for a specific user, you don't have to remember all the cache keys you used for that user, you just clear the entire list:

```php
foreach ($e->Cache->huge->listGetAll($cacheListName) as $listKey)
    $e->Cache->huge->listDel($cacheListName, $listKey);
```

Check [Lists methods](/version-0.x/reference/core-classes/cacheprovider/cacheprovider-methods.md#list-methods) to see more ways to interact with cache lists.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cherrycake.tin.cat/version-0.x/guide/cache-guide/lists.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
