# $Cache.Session

A global merge field to access an org’s session cache from a Visualforce page. Retrieve cached values from a specified partition’s session cache in the referenced org.

## Usage

Use `{!$Cache.Session}` to reference an existing session cache. A session cache consists of cached data that can be reused from one session to the next. Use dot notation to specify the namespace, partition name, or properties of a cached value.

## Examples

This output text component retrieves a cached value from the myPartition partition and myNamespace namespace with the key `output`.

```visualforce
<apex:outputText value="{!$Cache.Session.myNamespace.myPartition.output}"/>
```

If the cached value is a data structure that has properties or methods, like an Apex list or a custom class, you can access the properties with`$Cache.Session` by using dot notation. For example, this markup invokes the `List.size()` Apex method if the value of `numbersList` is declared as a `List`.

```visualforce
<apex:outputText value="{!$Cache.Session.myNamespace.myPartition.numbersList.size}"/>
```

If you’re using `CacheBuilder`, qualify the key name with the class that implements the `CacheBuilder` interface and the literal string `_B_`, in addition to the namespace and partition name. In this example, the class that implements `CacheBuilder` is called `CacheBuilderImpl`.

```visualforce
<apex:outputText value="{!$Cache.Session.myNamespace.myPartition.CacheBuilderImpl_B_key1}"/>
```

**See Also**

- [Cache.Session Class](https://help.salesforce.com/s/articleView?id=platform.cl_about.htm\&type=5)
- [Cache.CacheBuilder Interface](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_interface_cache_CacheBuilder.htm#apex_interface_cache_CacheBuilder)
