---
schema_version: "1"
id: 32ec791037f900bad44b031bf02269e77b38289c39760a883d4b01392c8c86a1
title: $Cache.Session
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/variables/pages-variables-global-cachesession.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-variables-global-cachesession.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8b617d70c8eebf1ddf5a8d4c60426b2a2ce50966704db4879bb9fe8eb76af9b7
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# $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)

