$Cache.Org

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

Usage

Use {!$Cache.Org} to reference an existing org cache. An org cache consists of data that’s shared across the org. 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.

<apex:outputText value="{!$Cache.Org.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.Org 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.Org.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.

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