# CacheGetAll()

this function return a structure containing all elements inside the cache.

```
CacheGetAll( filter=string, cacheName=string );
```

**Returns:** struct

# Arguments

| Argument | Type | Required | Description | Default |
|----------|------|----------|-------------|---------|
| filter | string | No | key filter for the elements, the filter follow the same rules as for cfdirectory-filter. |  |
| cacheName | string | No | definition of the cache used by name, when not set the "default Object Cache" defined in Lucee Administrator is used instead. *Alias: cache, region* |  |

# Examples

```1
// define a RAM cache as the default object cache
application action="update" caches="#{ trycf: {
	class: 'lucee.runtime.cache.ram.RamCache',
	custom: { timeToIdleSeconds: 3600, timeToLiveSeconds: 3600 },
	default: 'object'
}}#";

cacheClear();
cachePut( "fruit:apple", "red" );
cachePut( "fruit:banana", "yellow" );
cachePut( "vehicle:car", "blue" );

// returns a struct — keys are the cache ids, values are the cached data
all = cacheGetAll();
dump( all );

// use a wildcard filter to get a subset
fruits = cacheGetAll( "fruit:*" );
dump( fruits ); // struct with 2 entries: fruit:apple and fruit:banana
```







# Categories

[Cache](../../categories/cache.md)

# See Also

[Getting Started with Caching](../../recipes/caching-getting-started.md)