• Darshit Pathak 10
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies

I have created 1 default platform cache partition(genSys) with 5MB Session Cache.
Created 2 VF pages and one controller.

I am setting cache data on load of 1 VF Page and using that data in 2nd VF Page. But I lose data after 5 minutes. My understanding is that it should remain available 8 hours if browser is not closed during that period.
Can anyone help how can I maintain session cache for few hours?
 
Below is my code.
SessionHold.vfp
<apex:page controller="SessionHoldController" action="{!holdSeesionVars}">

</apex:page>

SesionGet.vfp
<apex:page controller="SessionHoldController" action="{!getSeesionVars}">
<h1>{!fnm} &nbsp; {!lnm}</h1>
</apex:page>

SessionHoldController.apxc
public with sharing class SessionHoldController {
    public static String fnm {get; set;}
    public static String lnm {get; set;}
    public SessionHoldController() {
    }
    public static void holdSeesionVars() {
        Cache.Session.put('local.gensysSession.firstName', 'ABC');
        String lnm = ApexPages.currentPage().getParameters().get('lnm');
        Cache.Session.put('local.gensysSession.lastName', lnm);
        System.debug(''+Cache.Session.MAX_TTL_SECS); //printing 28800
    }

    public static void getSeesionVars() {
        if (Cache.Session.contains('firstName')) {
            fnm = (String)Cache.Session.get('local.gensysSession.firstName');
        }
        if (Cache.Session.contains('lastName')) {
            lnm = (String)Cache.Session.get('local.gensysSession.lastName');
        }
        System.debug('Fnm: '+fnm+' lnm: '+lnm);
    }
}
 

I have written a webService for external system, while external system hit the sfdc to utilize the webSrive and suppose SOQL 101 or CPU time limit exception occured, so transaction fails right away there.
So is there any way I can send proper response in soap:fault format, to external system?
I had one trailhead account but it had email address of my previous organization. I had linked that trailhead account with webassessor.
I have created new trailhead account with my personal email address now. And merged the old trailhead account in new one.
So all badges and points are visible in new tarilhead account.
But webassessor is still linked to the old trailhead account only. So whichever maintenance exam I am completing is not reflecting in the results.
I tried to link the new(merged) trailhead account with webassessor but I am not getting any unique verification code on my email. So I am not able to link it.
Can anyone help me to link this new account and remove the old link?

I have created 1 default platform cache partition(genSys) with 5MB Session Cache.
Created 2 VF pages and one controller.

I am setting cache data on load of 1 VF Page and using that data in 2nd VF Page. But I lose data after 5 minutes. My understanding is that it should remain available 8 hours if browser is not closed during that period.
Can anyone help how can I maintain session cache for few hours?
 
Below is my code.
SessionHold.vfp
<apex:page controller="SessionHoldController" action="{!holdSeesionVars}">

</apex:page>

SesionGet.vfp
<apex:page controller="SessionHoldController" action="{!getSeesionVars}">
<h1>{!fnm} &nbsp; {!lnm}</h1>
</apex:page>

SessionHoldController.apxc
public with sharing class SessionHoldController {
    public static String fnm {get; set;}
    public static String lnm {get; set;}
    public SessionHoldController() {
    }
    public static void holdSeesionVars() {
        Cache.Session.put('local.gensysSession.firstName', 'ABC');
        String lnm = ApexPages.currentPage().getParameters().get('lnm');
        Cache.Session.put('local.gensysSession.lastName', lnm);
        System.debug(''+Cache.Session.MAX_TTL_SECS); //printing 28800
    }

    public static void getSeesionVars() {
        if (Cache.Session.contains('firstName')) {
            fnm = (String)Cache.Session.get('local.gensysSession.firstName');
        }
        if (Cache.Session.contains('lastName')) {
            lnm = (String)Cache.Session.get('local.gensysSession.lastName');
        }
        System.debug('Fnm: '+fnm+' lnm: '+lnm);
    }
}