Skip to main content
Gruppo

Platform Cache

The Salesforce Community of Evangelists for Platform Cache. We're here to support and grow the community of users who achieve their goals, using Platform Cache.

@Gaurang Mathur @Matthew Parin In the Platform Cache Considerations document, it is stated that "Some or all cache is invalidated when you modify an Apex class in your org".

 

I'm wondering if this is done cross-namespace, or only within a namespace? Specifically, I'm curious if ISV Platform Cache is protected from invalidation by an Apex Class modification in subscriber org's custom namespace

3 risposte
  1. Jonathan Fox (Cooper Parry) Forum Ambassador
    28 mag 2023, 13:05
    The session cache can store values up to eight hours. The org cache can store values up to 48 hours.
0/9000

I'm trying to build a beta 2GP package with provider free platform cache (the package has passed security review).   However I get this: 

 

[Error]: Package creation failed with error:                

                    package: Invalid provider free capacity allocation. Provider Free capacity not available

 

Any idea why that might be?  Everything works in scratch orgs with the "PlatformCache" scratch org setting enabled.

 

The cache is defined as:

 

<?xml version="1.0" encoding="UTF-8"?>

<PlatformCachePartition xmlns="http://soap.sforce.com/2006/04/metadata">

<description>...</description>

<isDefaultPartition>false</isDefaultPartition>

<masterLabel>package</masterLabel>

<platformCachePartitionTypes>

<allocatedCapacity>0</allocatedCapacity>

<allocatedPartnerCapacity>0</allocatedPartnerCapacity>

<allocatedPurchasedCapacity>0</allocatedPurchasedCapacity>

<allocatedTrialCapacity>0</allocatedTrialCapacity>

<cacheType>Session</cacheType>

</platformCachePartitionTypes>

<platformCachePartitionTypes>

<allocatedCapacity>3</allocatedCapacity>

<allocatedPartnerCapacity>3</allocatedPartnerCapacity>

<allocatedPurchasedCapacity>0</allocatedPurchasedCapacity>

<allocatedTrialCapacity>0</allocatedTrialCapacity>

<cacheType>Organization</cacheType>

</platformCachePartitionTypes>

</PlatformCachePartition>

1 risposta
  1. 11 mar 2022, 13:41

    @Matthew Parin Any idea why an ISV might get this error when uploading a second generation package with Provider Free Platform Cache?  Thanks!

0/9000

Are there some restrictions around platform cache and the automated process ?

I've a platform event that needs to run a process that includes reading something from the Org wide cache. The process is run as the Automated process (via the PE trigger) and it cannot read the Org cache value so doesn't work. Appreciate any thoughts. Thanks

2 commenti
0/9000

The linked SFSE question covers the problem in more detail, but generally, if I'm in Apex and have a Cache.OrgPartition, how can I tell if it actually has any capacity to cache data without calling getCapactiy()?

 

I don't want to waste resources trying to cache things into an empty cache. Nor to I want to call the potentially expensive getCapacity() method when I'm trying to use the cache to avoid expensive operations.

How can I detect that a packaged Platform Cache Partition has no capacity allocated?

0/9000

Great news to share! Our own @Anil Jacob just published a Salesforce Developer Blog post on Platform Cache.

 

If you ever wanted to learn more about Platform Cache, start here: https://developer.salesforce.com/blogs/2020/06/caching-in-the-salesforce-platform.html.

 

And once you're ready for even more Platform Cache, head over to @Karishma Lalwani's page. She has a survey out to the Salesforce Trailblazer Community that will definitely be of interest. Link: https://success.salesforce.com/0D53A00004v6s5l.

7 commenti
  1. 26 set 2020, 02:39
    @Anil Jacob

    I appreciate your feedback.

    To clarify the use case here, what we're effectively doing is collecting session level metrics on Apex transactions that were kicked off by CRUD API calls. The destination of the data collected is a logging framework rather than the record that fired the trigger. The use of Session Cache is to ensure we don't waste cycles logging metrics we've already seen in the same session. If the same or different user fires the same trigger we do want different outcomes because those are new metrics to record.

    As long as I know I can depend on current behaviour I'm good. Thanks again!

0/9000

Exciting news for all those either using or considering Platform Cache for their Salesforce apps!

Anil, Amol, and I will be giving the talk `Platform Cache: Why Implementing Platform Cache Is Just Like Riding a Bike` at Dreamforce 2019. We'll be on stage November 19 at 12:30 PM in the Metreon AMC Theater.

You can catch us online at

#DF19 by following the link: salesforce.com/live (http://salesforce.com/live).
0/9000