/** * A wrapper method for the set_transient() function. * */ public function setTransient($strTransientKey, $vData, $intTime = null) { $sLockTransient = AmazonAutoLinks_Commons::TransientPrefix . '_' . md5("Lock_{$strTransientKey}"); // Check if the transient is locked if (AmazonAutoLinks_WPUtilities::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_WPUtilities::setTransient($sLockTransient, time(), AmazonAutoLinks_Utilities::getAllowedMaxExecutionTime(30, 30)); // AmazonAutoLinks_Debug::logArray( 'set transient: ' . $strTransientKey ); // Save the cache AmazonAutoLinks_WPUtilities::setTransient($strTransientKey, array('mod' => $intTime ? $intTime : time(), 'data' => $this->oEncrypt->encode($vData))); // no expiration by itself // AmazonAutoLinks_Debug::logArray( 'the transient is saved: ' . $strTransientKey ); // AmazonAutoLinks_WPUtilities::deleteTransient( $sLockTransient ); }