Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class PersonSessionCache {
- private static final String FORMAT_PERSON_KEY = '{0}_Person_Id';
- public static Id getPersonId(){
- if (Cache.Session.contains(getPersonCacheKey())){
- return (Id)Cache.Session.get(getPersonCacheKey());
- }
- return null;
- }
- public static void setPersonId(Id personId){
- Cache.Session.put(getPersonCacheKey(), personId)
- }
- public static void clearCache(){
- Cache.Session.remove(getPersonCacheKey());
- }
- private static String getPersonCacheKey(){
- List<String> arguments = new List<String> {UserInfo.getProfileId()};
- return String.format(FORMAT_PERSON_KEY, arguments);
- }
- }
Add Comment
Please, Sign In to add comment