You need to sign in to do that
Don't have an account?
Debasish Paul 11
Can anybody please explain the query caching in salesforce with example?
Please explain query caching with example.
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
You can use a static variable in a helper class to cache the result while running a single transaction.
public class UserProfileHelper {
private static Profile userProfile;
public static Profile getProfile() {
if (userProfile == null)
userProfile = [select Id, Name from Profile where Id = :userInfo.getProfileId()];
return userProfile;
}
}
Reference : https://salesforce.stackexchange.com/questions/71621/caching-soql-query-results
1) You can use the global variable "Useinfo.getProfileId()" if you only need profile id.
2) You can use static variable to cache profile you query. see code:
Thanks,
Shruti Khodabole
Salesforce Developer
http://www.zen4orce.com