Questions tagged [platform-cache]

The Force.com Platform Cache layer provides faster performance and better reliability when caching Salesforce session and org data. Specify what to cache and for how long without using custom objects and settings or overloading a Visualforce view state. Platform Cache improves performance by distributing cache space so that some applications or operations don’t steal capacity from others.

Filter by
Sorted by
Tagged with
0
votes
0answers
45 views

How to access Platform Cache using REST API

I have a requirement to retrieve available resource and consumed resources for Platform Cache outside my salesforce org. I was wondering if we can use REST API to retrieve this result ? Given a try by ...
0
votes
0answers
41 views

Session cache is only supported in Data Silo tests error while running test class

I have the following piece of code and whenever I am calling it from a test class it throws me an error public static void storeAssetMap(Map<ID,List<AssetLineItem>> assetMap, String ...
2
votes
0answers
19 views

Is it possible to make cache session expiry time based on put instead of get

In Apex, when we put information into cache.session, there is a method to set the expiry time based on seconds. However, that expiry time seems to be re-calculated every time we put or get into/from ...
1
vote
1answer
78 views

Platform Cache - error-like debug log message

I have a requirement where I need to make a callout to an external webservice. However, to make the callout, I need to get a OpenId Auth Token from a corporate webservice first. So, I am trying to use ...
0
votes
1answer
39 views

Best Approach to Store and Retrieve session information

I am not very old player in Salesforce Integration but I have basic knowledge of Salesforce Integration. For my learning I have created some methods which gets session information from other ...
0
votes
0answers
42 views

LWC - Component not refreshing after NavigationMixin save [duplicate]

I have a button that points to a NavigationMixin that opens a popup for creating a new child record for the parent record they are currently looking at: navigateToNew() { this[...
0
votes
0answers
47 views

Alternative for using multiple callouts from Salesforce to external System

We retrieve a list of flight passengers from an external system via a callout. The endpoint sends us a passenger list along with arrival and departure airport codes. Our external system has another ...
0
votes
0answers
91 views

Platform Org Cache returning null

Trying to access a value stored in platform org cache in lightning context but returns null. Need to invoke a third party api from lwc for which I need to make a prior call to get token. Leveraged ...
2
votes
1answer
61 views

Platform Cache and default partition

I am implementing the platform cache for first time. My query in below snippent is taking lot of time so I want to put the query result in cache/ if(Cache.Org.contains('cvList')){ for (...
0
votes
0answers
144 views

Incorrect Lightning record page shown for users

We have a profile called as "Consumer Banker", and Consumer Banker profile has the "Consumer Individual Record Page" assigned for the App + Record Type + Profile combination. The ...
2
votes
1answer
64 views

Is there a limit to how many concurrent or total retrievals you can make with Platform Cache?

The features documentation mentions that the Platform Cache API is what allows you to store and retrieve data that's tied to a Salesforce session or shared across your org. Seeing "API" ...
0
votes
1answer
67 views

Use Platform Cache to cache ~50 records from a custom object

We have a custom object that realistically should have been Custom Metadata / Custom Settings as it stores background metadata that controls how pages within our Community load. It has been very ...
2
votes
0answers
44 views

Org Cache Behaving differently in Sandbox

I'm using org cache to store the results of a call to the google maps geocode api. Just noticed, the caching doesn't seem to work in a Sandbox. You can see how I'm storing/accessing here: public ...
7
votes
2answers
186 views

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

I have a platform cache partition that is packaged as part of a managed package. Once it is installed in a subscribers org it defaults to zero capacity. Using getPartition() and OrgCacheException I ...
4
votes
0answers
574 views

Detecting change on Record in Lightning Web Component withing Communities

I am looking for a solution to a basic scenario: A User in a Community submits an Opportunity, this Opportunity is enriched with data synchronously upon insert and asynchronously through ...
3
votes
1answer
360 views

What is the “default time to live” (TTL) for Platform Cache?

The Platform Cache Partition Class allows a time to live to be specified when a value is put into the cache: put(key, value, ttlSecs) Stores the specified key/value pair as a cached entry in the ...
1
vote
0answers
25 views

Writing master-detail records to platform cache

Platform Cache is very good feature for my development work. Today I came across a scenario which it doesn't work the way I intended. Perhaps someone can clarify that for me. I have retrieved a ...
1
vote
1answer
84 views

How to get time left on OrgPartition from Platform Cache?

Is it possible to get the time left from Platform Cache for a particular partition? You initiate by: Cache.OrgPartition orgPart = Cache.Org.getPartition('local.myStore'); You put the value by (...
17
votes
1answer
263 views

Does data referenced from the Platform Cache consume heap space?

Reading Platform Cache Limits, it appears that an individual request can obtain up to 1 MB of data from the Platform Cache: Maximum local cache size for a partition, per-request 1,000 KB ... ...
1
vote
0answers
99 views

Is it possible to cache into local org partition from a managed package?

Is it possible to cache into local org partition from a managed package? In other words can we do this Cache.Org.put('local.ABCPartition.XYZ', 'Test Object'); from the managed package, where in ...
0
votes
1answer
212 views

Does “Request Trial Capacity” for Platform Cache work in scratch orgs?

I clicked the "Request Trial Capacity" button 20 minutes ago in a scratch org and Get Started with Platform Cache says: Click Request Trial Capacity and wait for the email notifying you that your ...
5
votes
1answer
148 views

Clean way for code to work with or without Platform Cache?

Just started trying out Platform Cache, and the code needs to work with or without cache partitions set up. As the first error I got was: SessionCacheException:[]: A default partition was not ...
4
votes
2answers
337 views

Platform Cache for ISVs

I have used Platform Cache as a customer a while ago but never heard any story about ISVs using it. So, I'm wondering: is there any ISV out there using it and if there is any, how?
4
votes
1answer
354 views

Salesforce Platform Cache not working in Sales Console

I am using the Platform Cache to store the Id of the customer the salesperson is speaking with on the phone, such that different Lightning Components automatically load the customer's details as the ...
5
votes
2answers
516 views

Maintain state in Visualforce Page without using View State

I would know if there is some way to maintain state across different transactions without using View State. For example, if in my Custom Controller, for every action method, I need 100 Account's ...
4
votes
1answer
275 views

Does the Platform Session Cache interpret multiple Site Guest User sessions separately?

I'm considering using a Platform Session Cache for User sessions on my force.com site. My question is: Does the Platform Session Cache interpret the "Force.com Site Guest User" as a single session, ...
6
votes
1answer
200 views

How to debug Lightning components with Platform Cache?

I am researching how to make use of platform cache in a lightning component to reduce the number of API calls that it will need to make. The problem is that when I push code for a Lightning component, ...
4
votes
1answer
487 views

How to specify namespace and partition for Org Cache when creating managed package?

I'd like to make an ISV App / Managed package that uses the Platform Org Cache. The clearest directions on how to do this are described in this trailhead. However, when writing my code, I am unclear ...
4
votes
1answer
3k views

SessionCacheException: A default partition was not found. To cache without partition reference, designate a partition as default

I have a simple class for storing values in the cache, similar to this: public class PersonSessionCache { private static final String PERSON_KEY = 'Person'; public static Id getPersonId(){ ...
3
votes
2answers
486 views

Cache.Session.contains() always returns False on next script execution even after adding Key with .put()

I am attempting to store values in Cache via an Apex script. I use the Cache.Session.put() method and if I subsequently call .contains() on the next line of the code then the Key shows properly as ...
1
vote
2answers
600 views

How to assign Cache time to Live in CacheBuilder interface?

I was experimenting with Platform Cache and stumbled upon CacheBuilder interface which looks robust for our use cache. The only problem is how can I set time to live in this interface? By default it ...
1
vote
1answer
228 views

Platform Cache.Session working only with debug mode

Case Scenario: I need to throw a warning to the user before changing the dates of the standard opportunity. Hence I used Cache.Session to store a variable that checks if the warning has been issued or ...
0
votes
1answer
119 views

Cache value not being saved in Org from Async call

I have a batch call that calls a queuaeble that calls a future call which utilizes a visualforce page 'getContentAsPdf' function. Also in this queuable call I set a custom class value to a local ...
1
vote
2answers
95 views

compiler Error : Invalid type: Cache.OrgPartition

I am trying to use Platform cache via Apex Code. 1. Created a new platform cache partition in my org - 10MB assigned to Org Cache. Then created a simple apex class via dev console to access the ...
3
votes
1answer
102 views

How does the Platform Cache reconcile the local cache being smaller than the partition size?

I'm reading through Platform Cache Internals and Platform Cache Limits with respect to the local cache and the overall partition size. It appears that the local cache (the application server's in-...
7
votes
1answer
2k views

Testing Platform Cache usage

When writing Apex test cases for code that utilizes the platform cache what are the important scenarios I need to cover? Additionally, how would I address those is the test methods? For instance, ...
3
votes
0answers
266 views

Example how Lightning components share data via custom Platform Cache

The title already contains basically everything. Using Google I didn't find a single code example on how to use a custom Platform Cache to save and retrieve data from Lightning components. This is ...
2
votes
1answer
157 views

Deploying PlatformCachePartition Metadata - Tests Fail

I noticed a strange behaviour when deploying PlatformCachePartition metadata which also includes test methods in the same package. Below is an example of the PlatformCachePartition metadata: <?xml ...
3
votes
0answers
130 views

How to tell if Platform Cache is available in package?

If I include a Cache Partition in my managed package but don't activate it in the subscriber org (i.e. subscriber has not purchased a license), how do I check if I should be hitting the cache or not? ...
3
votes
1answer
366 views

Platform Cache System Error (Random)

A few of the users in the system have hit an interesting error after implementing some functionality around the platform cache. I received the emails as the owner of the files, but I was not able to ...
6
votes
1answer
1k views

Platform cache is cleared randomly?

While I doubt the speculation that I put in the title is correct, from time to time my default cache partition (10MB trial) gets emptied within less than an hour. There are about 20 keys in there, ...
1
vote
1answer
2k views

Cache.Session return null value

I have create small function to store and retrieve the value inside static using session cache. but i am unable to get the data which i have stored in session cache. I am not getting any error on ...
1
vote
0answers
58 views

Accessing partitions in Platform cache

I have created a couple of partitions in the platform cache of my Org.One of them is default. As per the documentation to access the default partition mentioning the name of the partition is enough ...
2
votes
2answers
76 views

Why does the cache seem to know my member variable's value before I save it?

I'm playing around with session/org caches, and I came across something interesting. It seems that if I create a class which can save itself to the cache, then change a member variable on an instance ...
4
votes
0answers
95 views

Platform cache increasing visualforce execution time

I have decided to use platform cache to retain the result of an expensive callout and processing. Doing so eliminated the callout time and shaved 500ms off of the apex time. Unfortunately my gains ...
1
vote
0answers
321 views

BUG: Unable to clear Platform Cache, Missing Capacity Visuals

I'm not sure why this happens or how to fix it... usually it just fixes its self within moments or hours (never really consistent). But some how the partition visuals just disappear. Unfortunately ...
10
votes
1answer
906 views

Visualforce Component PageReference Method: Platform Cache PUT() Not Allowed?

Right now I have a "Refresh" button on my page that collects some data and sends it to this method: public static Boolean cacheData(String index, MyObject data) { try {reportPartition.put(hash(...
4
votes
1answer
3k views

Why Org cache is not working?

I have been trying to use the Org cache but for some reason cached item is getting removed in the subsequent requests. Below is the code which i wrote inside the controller class if (!Cache.Org....
4
votes
1answer
3k views

Calculate the data size of a given object

I am evaluating the possibility of using the new Platform Cache to store reporting data for each of our franchise records. I could possibly use a custom object instead but for every data point I want ...
7
votes
1answer
2k views

Can the Platform-cache store data with any data type?

I know there are limitations to platform cache though, within the limitation(capacity) is it allowed to store any type of data (Collections, Integer, DateTime, sObject etc...) in the cache? What if ...