Let's say I have the following method getMyString()
in my Apex Controller.
I would like to refresh this SOQL query once in 30 minutes. Would it be possible to store the data in a 'local storage' type of way?
Example Pseudo Solution
if( LocalServerStorage.get( 'lastStoredDate' ) != new Date() )
{
String myString = [ /* .. SOQL .. */ ];
LocalServerStorage.store( 'myString', myString );
LocalServerStorage.store( 'lastStoredDate', new Date() );
}
else
String myString = LocalServerStorage.get( 'myString' );
Sample SOQL code
public static String getMyString()
{
return [
SELECT
MyString__c
FROM
Strings__c
WHERE
Key = 'My String'
WITH
SECURITY_ENFORCED
LIMIT 1
];
}