Apex method to expose the total capacity allocated to a Platform Cache partition - Ideas - Salesforce Trailblazer Community
Trailblazer Community

All Ideas

Idea Details

Post an Idea
30  Points
Idea has been posted. Give it an upvote or downvote.

Apex method to expose the total capacity allocated to a Platform Cache partition

Development (Apex, LWC & VF)

Currently a Platform Cache that is deployed as part of a managed package may or may not have any cache capacity allocated to it.

There currently isn't a way to tell in Apex if a Platform Cache has any capacity allocated to it. As such, resources (CPU/callouts/SOQL queries) will be expended trying populate and use a cache that won't retain anything.

The Spring '21 release now includes 3 MB of free Platform Cache for AppExchange-certificed packages. This helps mitigate the problem in many cases if you can spread that 3 MB across all your caches.

It does still leave a gap where it might not be possible to allocate any capacity to a paritcular cache. E.g. the cache might not be applicable to all subscribers, so it doesn't make sense to always allocate to it.

If there was a method on the Partition class that indicated the storage allocated to it we could easily check in Apex how viable the cache is at runtime.

More details are in How can I detect that a packaged Platform Cache Partition has no capacity allocated?

Merge Idea · Flag

  • Upvotes
  • Downvotes



from AppExchange


No results found.

Help us to keep IdeaExchange clean by pointing out overlapping ideas. We'll investigate your suggestion and merge the ideas if it makes sense.



Thanks for your merge suggestion. We will review it shortly and merge the ideas if applicable.

Salesforce takes abuse situations very seriously. Examples of abuse include but are not limited to posting of offensive language or fraudulent statements. To help us process your request as quickly as possible, please fill out the form below describing the situation. For privacy and security reasons, the final outcome of an abuse case may not be revealed to the person who reported it.


Thank you for your feedback. We take abuse seriously and will investigate this issue and take appropriate action.