function salesforce_api_cache_build in Salesforce Suite 7
Same name and namespace in other branches
- 6.2 salesforce_api/salesforce_api.module \salesforce_api_cache_build()
- 7.2 salesforce_api/salesforce_api.module \salesforce_api_cache_build()
Recreate the salesforce object cache
3 calls to salesforce_api_cache_build()
- salesforce_api_admin_object_submit in salesforce_api/
salesforce_api.admin.inc - FAPI submit handler Gather enabled SF Objects and rebuild the cache.
- salesforce_api_cron in salesforce_api/
salesforce_api.module - Implements hook_cron().
- salesforce_api_fieldmap_objects in salesforce_api/
salesforce_api.module - Implements hook_fieldmap_objects().
1 string reference to 'salesforce_api_cache_build'
- salesforce_api_settings_form in salesforce_api/
salesforce_api.admin.inc - The settings form at admin/config/salesforce.
File
- salesforce_api/
salesforce_api.module, line 320 - Defines an API that enables modules to interact with the Salesforce server.
Code
function salesforce_api_cache_build() {
$sf_objects = variable_get('salesforce_api_enabled_objects', array(
'Campaign',
'Contact',
'Lead',
));
$sf = salesforce_api_connect();
$result = salesforce_api_describeSObjects($sf_objects);
foreach ($sf_objects as $i => $obj) {
$objects[$obj] = salesforce_api_object_to_fieldmap_fields($result[$obj]);
}
// find the expiry time
$lifetime = variable_get('salesforce_api_object_expire', CACHE_PERMANENT);
$expire = $lifetime == CACHE_PERMANENT ? CACHE_PERMANENT : REQUEST_TIME + $lifetime;
cache_set('salesforce_api_sf_objects', $objects, $table = 'cache', $expire, $headers = NULL);
drupal_set_message(t('Salesforce object cache has been refreshed.'));
return $objects;
}