當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Client::expireat方法代碼示例

本文整理匯總了PHP中Predis\Client::expireat方法的典型用法代碼示例。如果您正苦於以下問題:PHP Client::expireat方法的具體用法?PHP Client::expireat怎麽用?PHP Client::expireat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Predis\Client的用法示例。


在下文中一共展示了Client::expireat方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: store

 /**
  * @param Password $password
  * @param bool $allowOverwrite
  */
 public function store(Password $password, $allowOverwrite = false)
 {
     if (!$allowOverwrite && $this->get($password->getId())) {
         throw new PhPsstException('The ID already exists', PhPsstException::ID_IS_ALREADY_TAKEN);
     }
     $this->client->set($password->getId(), $password->getJson());
     $this->client->expireat($password->getId(), $password->getTtl());
 }
開發者ID:felixsand,項目名稱:phpsst,代碼行數:12,代碼來源:RedisStorage.php

示例2: expireIn

 public function expireIn($key, $seconds)
 {
     $redisTime = $this->client->time();
     $at = ceil($redisTime[0] + $seconds);
     $this->client->expireat($this->prefixTimestamp($key), $at);
     return (int) $this->client->expireat($this->prefixKey($key), $at) === 1;
 }
開發者ID:beheh,項目名稱:flaps,代碼行數:7,代碼來源:PredisStorage.php

示例3: storeAssociation

 /**
  * Store association until its expiration time in Redis server. 
  * Overwrites any existing association with same server_url and 
  * handle. Handles list of associations for every server. 
  */
 function storeAssociation($server_url, $association)
 {
     // create Redis keys for association itself
     // and list of associations for this server
     $associationKey = $this->associationKey($server_url, $association->handle);
     $serverKey = $this->associationServerKey($server_url);
     // save association to server's associations' keys list
     $this->redis->lpush($serverKey, $associationKey);
     // Will touch the association list expiration, to avoid filling up
     $newExpiration = $association->issued + $association->lifetime;
     $expirationKey = $serverKey . '_expires_at';
     $expiration = $this->redis->get($expirationKey);
     if (!$expiration || $newExpiration > $expiration) {
         $this->redis->set($expirationKey, $newExpiration);
         $this->redis->expireat($serverKey, $newExpiration);
         $this->redis->expireat($expirationKey, $newExpiration);
     }
     // save association itself, will automatically expire
     $this->redis->setex($associationKey, $newExpiration - time(), serialize($association));
 }
開發者ID:Stony-Brook-University,項目名稱:doitsbu,代碼行數:25,代碼來源:PredisStore.php

示例4: flush

 /**
  *
  */
 public function flush()
 {
     $this->client->transaction(function () {
         foreach ($this->buffer as $name => $options) {
             $ttl = $this->client->ttl($name);
             $exists = $this->client->exists($name);
             $this->client->set($name, $options['value']);
             if ($options['expire'] > 0) {
                 $this->client->expire($name, $options['expire']);
             }
             if ($options['expire'] < 0) {
                 if (!$exists || $ttl < 0) {
                     $this->client->expireat($name, time() + $options['expire'] * -1);
                 } else {
                     $this->client->expire($name, $ttl);
                 }
             }
         }
     });
 }
開發者ID:jced-artem,項目名稱:test_game,代碼行數:23,代碼來源:Cache.php


注:本文中的Predis\Client::expireat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。