当前位置: 首页>>代码示例>>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;未经允许,请勿转载。