使用php的aws elasticache - 无法设置键/值对


早岁那知世事艰
2025-03-12 11:00:16 (27天前)


我可以像这样连接到我的弹性集群:

$ awsElasticache = new ElastiCacheClient(CredentialProvider :: atsDefaultConfigConstructor(false,false));
$ clusterResult = $ awsElasticache-> …

2 条回复
  1. 0# 一号位 | 2019-08-31 10-32



    要在Memcached中设置键/值对,请始终从当前时间延长到期时间。



    试试这个




    1. $this->mem = new Memcached();
      $this->mem->addServer($this->endPoint,11211);

    2. $expires = Carbon::now()->addMinutes(10);
      $this->mem->set(‘myKey’,’myValue’, $expires);
      $result = $this->mem->get(‘myKey’);
      echo $result;

    3. </code>



    NOTE:

    出于某种原因,Memcached最适合

    Carbon

    时间



    看到

    https://artisansweb.net/work-php-datetime-using-carbon/

    关于如何设置和使用

    Carbon

    在你当前的项目上


登录 后才能参与评论