/** * Push a item on the cache at 'key' * * Examples: * <code> * Yii::app()->yiiron->cachePutItem("test_cache", 'default', "Hello world"); * </code> * <code> * $cache->putItem("test_cache", 'default', array( * "value" => "Test Item", * 'expires_in' => 2*24*3600, # 2 days * "replace" => true * )); * </code> * * @param string $cache Name of the cache. * @param string $key Item key. * @param array|string $item * @throws CException * @return mixed */ public function cachePutItem($cache, $key, $item) { try { return $this->_cache->putItem($cache, $key, $item); } catch (Exception $e) { Yii::log('Error in Iron Cache: ' . $e->getMessage(), 'error', 'ext.yiiron'); throw new CException($e->getMessage()); } }
function update_message_status($payload, $email) { echo "Updating status\n"; //Ping your api echo "pinging api\n"; file_get_contents('http://google.com/?email=' . urlencode($email)); if (!empty($payload->token) && !empty($payload->project_id)) { //Or update date of last email in iron_cache echo "setting iron_cache\n"; $cache = new IronCache(array('token' => $payload->token, 'project_id' => $payload->project_id)); $res = $cache->putItem('mail', $email, date("D M d, Y G:i")); print_r($res); } }