---
schema_version: "1"
id: 73eb4500ed65a7d98630dadb17a13600e93f27f0d8a91ca570f7669ee23225fe
title: Apex Caching on the Salesforce CDN
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/experience/264-0-0/exp_cloud_perf_apex_caching.md
canonical_url: https://help.salesforce.com/s/articleView?id=experience.exp_cloud_perf_apex_caching.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 960713699fdf65d8dd8035e2d0f06f9ccc72ae190efdbc05c126253e46d5b8a6
description: When you cache Apex methods on the Salesforce content delivery network (CDN), you improve performance of your LWR site, and your customers benefit from faster page load times. Only public data from Apex methods is intended to be cached, and it’s only cached for guest users. Apex caching controls differ depending on the type of Apex methods in your site.
products:
  - Experiences
release: "264"
---
# Apex Caching on the Salesforce CDN

When you cache Apex methods on the Salesforce content delivery network (CDN), you improve performance of your LWR site, and your customers benefit from faster page load times. Only public data from Apex methods is intended to be cached, and it’s only cached for guest users. Apex caching controls differ depending on the type of Apex methods in your site.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: both Salesforce Classic and Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, and <strong>Unlimited</strong> Editions. Also available with Marketing Cloud Account Engagement (Pardot) in <strong>Professional</strong> Edition.</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Applies to: <a href="https://help.salesforce.com/s/articleView?id=experience.exp_cloud_basics_glossary.htm&amp;type=5&amp;language=en_US" target="_blank">LWR, Aura, and Visualforce sites</a></td></tr></tbody></table>

For Apex methods that you own, enable caching by using caching annotation. Annotate your Apex methods with @AuraEnabled(cacheable=true scope=’global’). And use @wire (LWC) to invoke publicly cacheable Apex actions. To avoid caching private data, annotate only Apex methods that return public data. Learn more about caching annotation in our developer guides.

- [Wire Apex Methods to Lightning Web Components](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.apex_wire_method)
- [AuraEnabled Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_AuraEnabled.htm)
- [Call Apex Methods Imperatively](https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.apex_call_imperative)

If your site uses managed packages, caching data from Apex methods in those packages is enabled by default. To disable it, deselect **Cache public data from Apex methods in Managed Packages** in Workspaces | Administration | Preferences.

![The preference Cache public data from Apex methods in managed packages is highlighted in the list of LWR site preferences.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-experience-communities-264-0-0-production-enus/bf7df212-91a1-4fa3-a007-4d6f3e3b470b/communities/images/cdn_apex_caching_preference.png)

![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-experience-communities-264-0-0-production-enus/bf7df212-91a1-4fa3-a007-4d6f3e3b470b/images/icon_important.png)

Important Only Apex methods that were annotated for caching in the managed packages get cached. If the Apex methods in the managed packages aren’t annotated, they don’t get cached even when the preference is enabled.

Salesforce controls caching of Apex methods used on standard pages and components, and caches it where appropriate.