FCORE_BASE.CacheService is an in-memory, per-transaction record cache that prevents duplicate SOQL. The first request for a given record-and-field combination queries and caches the result; later requests in the same transaction only query the Ids and fields that have not yet been cached.
There are two singletons, one per sharing mode:
FCORE_BASE.CacheServiceWithSharing— respects the running user’s sharing rules.FCORE_BASE.CacheServiceWithoutSharing— ignores sharing.
getInstance(). Most feature code reaches the cache indirectly through a DB class, which is the preferred way to query an object; use CacheService directly when you are writing or extending a DB class.
Caching Fields on a Record
UsegetById(SObjectType, Id, <fields>) for a single record and getByIds(SObjectType, Set<Id>, <fields>) for many. The id argument is a single Id for getById and a Set<Id> (not a List) for getByIds. The <fields> argument can be a CSV String, a Set<String>, or a List<SObjectField>:
Caching Relationships With QueryUnit
To cache a parent record together with its child records (a subquery), use a FCORE_BASE.QueryUnit. QueryUnit is its own top-level class — not an inner class of CacheService.
Constructors:
QueryUnit(SObjectType, Set<String>)QueryUnit(SObjectType, List<SObjectField>)QueryUnit(SObjectType, String)
addChildQueryUnit(QueryUnit queryUnit, String relation), then pass the parent QueryUnit to getById(QueryUnit, Id) or getByIds(QueryUnit, Set<Id>):

