Use a Visualforce Global Variable for the Platform Cache
You can use either the $Cache.Session or $Cache.Org global variable. Include the global variable’s fully qualified key name with the namespace and partition name.
This output text component retrieves a session cache value using the global variable’s namespace, partition, and key.
<apex:outputText value="{!$Cache.Session.myNamespace.myPartition.key1}"/>
This example is similar but uses the $Cache.Org global variable to retrieve a value from the org cache.
<apex:outputText value="{!$Cache.Org.myNamespace.myPartition.key1}"/>
If a namespace isn’t defined for the org, use local to refer to the org’s namespace.
<apex:outputText value="{!$Cache.Session.local.myPartition.key1}"/>
The cached value is sometimes a data structure that has properties or methods, like an Apex list or a custom class. In this case, you can access the properties in the $Cache.Session or $Cache.Org expression by using dot notation. For example, this markup invokes the List.size() Apex method if the value of numbersList is declared as a List.
<apex:outputText value="{!$Cache.Session.local.myPartition.numbersList.size}"/>
This example accesses the value property on the myData cache value that is declared as a custom class.
<apex:outputText value="{!$Cache.Session.local.myPartition.myData.value}"/>
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.
<apex:outputText value="{!$Cache.Session.myNamespace.myPartition.CacheBuilderImpl_B_key1}"/>