/** * A wrapper method for the set_transient() function. * * @since unknown * @since 3 Changed the name from `setTransient()`. */ public function setCache($sTransientKey, $vData, $iDuration = 0, $sRequestURI = '') { $sLockTransient = AmazonAutoLinks_Registry::TRANSIENT_PREFIX . '_' . md5("Lock_{$sTransientKey}"); // Check if the transient is locked if (AmazonAutoLinks_WPUtility::getTransient($sLockTransient) !== false) { return; // it means the cache is being modified right now in a different process. } // Set a lock flag transient that indicates the transient is being renewed. AmazonAutoLinks_WPUtility::setTransient($sLockTransient, time(), AmazonAutoLinks_WPUtility::getAllowedMaxExecutionTime(30, 30)); // Save the cache if ($this->bUseCacheTable) { $_oCacheTable = new AmazonAutoLinks_DatabaseTable_request_cache(AmazonAutoLinks_Registry::$aDatabaseTables['request_cache']); $_aData = $_oCacheTable->setCache($sTransientKey, array('mod' => time(), 'data' => $vData), (int) $iDuration, array('request_uri' => $sRequestURI, 'type' => 'api')); } else { AmazonAutoLinks_WPUtility::setTransient($sTransientKey, array('mod' => time(), 'data' => $this->oEncrypt->encode($vData)), 9999999); } }