Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal8设置redis键TTL_Redis_Drupal 8 - Fatal编程技术网

Drupal8设置redis键TTL

Drupal8设置redis键TTL,redis,drupal-8,Redis,Drupal 8,我一直在尝试从Drupal内部设置Redis键的TTL,但它似乎不起作用。我们的settings.php如下所示: // Set Redis as the default backend for any cache bin not otherwise specified. $settings['cache']['default'] = 'cache.backend.redis'; $settings['redis.connection']['interface'] = 'PhpRedis

我一直在尝试从Drupal内部设置Redis键的TTL,但它似乎不起作用。我们的settings.php如下所示:

// Set Redis as the default backend for any cache bin not otherwise specified.
  $settings['cache']['default'] = 'cache.backend.redis';
  $settings['redis.connection']['interface'] = 'PhpRedis';
  $settings['redis.connection']['host'] = '127.0.0.1';
  $settings['redis.connection']['port'] = '6379';
  $settings['redis.connection']['base'] = 8; // This is the DB ID.
  #$conf['cache_lifetime_redis'] = 21600;
  #$settings['redis.settings']['perm_ttl_cache_field'] = "3 months";
  $conf['redis_perm_ttl'] = "3 months";

我试过使用
$conf['cache\u lifetime\u redis']=21600,带有
$settings['redis.settings']['perm\u ttl\u cache\u field']=“3个月”
$conf['redis\u perm\u ttl']=“3个月”无效。连接REDIS时,TTL仍然设置为1年。还需要做什么才能使这项工作成功?由于是共享环境,因此在服务器级别进行此设置是不可行的

您可以分别为每个键设置TTL。正如参考文献所说:@AminShojaei-不确定这将如何工作。我们有数百万个键,需要从Drupal(php代码)本身注入TTL。