3

Just curious on the visibility of a setting created in the platform org cache. I have a process that runs and creates this name-value pair and I then try interrogating it from the Dev Console and it does not find it. Are there known restrictions on the visibility/entitlements across processes?

process 1:

cache.Org.put(key, value, 300);

Dev Console Anonymous code:

cache.Org.get(key);
2
  • what type of "process" sets the value? Are you sure you are checking it within 5 minutes of when it was set? – NSjonas Dec 29 '15 at 6:08
  • Vamsi - the process is just some apex code running in a helper class being called from a controller. Yes - I'm doing the Dev Console call within the timeout period. – Ram Dec 29 '15 at 12:24
1

As per arguments you have passed in method:

cache.Org.put(key, value, 300);

The "value" for "key" will be available for 5 minutes only. After that you will get null.

Try with following example:

cache.Org.put('local.Partition.pKey', 'value of key pKey', 300); // 5 min
System.debug(' => value is '+ cache.Org.get('local.Partition.v'));

then execute only one statement:

System.debug(' => value is '+ cache.Org.get('local.Partition.v'));

You will get 'value of key pKey' if code execute within 5 minutes.

Visibility

The org cache is not tied to any session and is available to the organization across requests and to all users.

You would check that you are not setting session cache.

3
  • Ashwani, thanks. Yes - I ran my test within the expiration time specified but was getting a null every time. Also - yes - I'm using the org cache rather than the session cache. – Ram Dec 29 '15 at 12:29
  • @Ram did you created partition before using it. Aslo it should have some capacity allocate. – Ashwani Dec 29 '15 at 15:03
  • Ashwani - yes - it could have been an issue with a typo in the key or may be I was indeed trying right after the expiration was done. I was able to successfully interrogate the org cache from the dev console. Thanks for your help! Thanks to Vamsi as well. – Ram Dec 29 '15 at 16:02

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.