cache api call object

This commit is contained in:
Marc Michalsky forumZFD 2021-01-18 10:46:13 +01:00
parent 36cfdd2a2d
commit 1d5c69f470
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
3 changed files with 14 additions and 1 deletions

View file

@ -77,7 +77,12 @@ function civicrm_api3_twingle_sync_Sync($params) {
: trim($params['twingle_api_key']);
// If function call does not provide a limit, set a default value
$limit = ($params['limit']) ?? 20;
$twingleApi = new TwingleApiCall($apiKey, $limit);
// Try to retrieve twingleApi from cache
$twingleApi = Civi::cache()->get('twinglecampaign_twingle_api');
if (NULL === $twingleApi) {
$twingleApi = new TwingleApiCall($apiKey, $limit);
}
if ($params['id'] && !$params['project_id']) {
// Get single TwingleProject