if (mongoConnector != null) {
MongoDBInvalidFieldCachingReferenceDataProvider fieldCached = new MongoDBInvalidFieldCachingReferenceDataProvider(underlying, mongoConnector);
return new MongoDBValueCachingReferenceDataProvider(fieldCached, mongoConnector);
} else if (cacheManager != null) {
ReferenceDataProvider fieldCached = new InMemoryInvalidFieldCachingReferenceDataProvider(underlying); // TODO: EHcached version
return new EHValueCachingReferenceDataProvider(fieldCached, cacheManager);
} else {
return new InMemoryInvalidFieldCachingReferenceDataProvider(underlying);
}
}