0

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 (with expiration value in seconds(500))):

orgPart.put('myValue', 'Value Here', 500);

You can get the value by:

String myValueString = (String) orgPart.get('myValue');

How do you / can you get the time left for myValue?

Documentation: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_platform_cache_org_examples.htm

  • What's the use case? Why do you wanna know how long is the value valid? – Pranay Jaiswal Oct 15 at 17:10
  • Salesforce Connect Token Management. We're storing an HTTP Request token in the platform cache and we're having some issues with it, so I'm trying to pull how much time is left before it expires from the cache. – S.B. Oct 15 at 17:30
0

From Salesforce Support:

Unfortunately, there is no such method which can calculate the time left from Platform Cache for a particular partition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.