I am basically from java backgroud and new to salesforce. Need suggestion on following query:
Suppose we have two custom objects - A and B . A has lookup field to B .
We have three objects data for A - A1, A2, A3. Following is the lookup filed mapping:
- A1's lookup field maps to B1
- A2's lookup field maps to B2
- A3's lookup field maps to B1
Now using below query, I get the object A1 and it related data B1
[SELECT prop1,prop2 (SELECT propx,propy FROM B_rel__r ) FROM A__c where name=:name]
Question : Does salesforce caches the object it load from SOQL ? If next time I use SOQL to retrieve object A3 (listed above) and its related object B1 (which is same as retrieved from previous query), then salesforce would provide the same object B1 from cache or would it freshly retrieve the object B1 from their database. I am asking this from performance point of view. Do we need to handle the caching in the above case ?