缓存没有被清除?

时间:2015-12-26 09:15:45

标签: caching drupal-7 memcached

在我的内容类型中,我有一个字段(field_fbunique),其默认值为0;以编程方式,我用下面的代码和清除缓存将其值更改为1。

该值更改为1,但是当admin用户编辑节点时,即使数据库中的值为1(按预期方式),字段值也会显示为0。

但是,要将其显示为1,我需要手动清除缓存。我启用了Memcached。

$node = node_load($nid);
$node->field_fbunique['und'][0]['value'] = 1;
field_attach_presave('node', $node);
field_attach_update('node', $node);
$nodeurl = url('node/'. $nid); 
cache_clear_all($nodeurl, 'cache_page');
entity_get_controller('node')->resetCache(array($nid));
drupal_flush_all_caches();

1 个答案:

答案 0 :(得分:0)

借助此代码从form_cache排除memcache_bins,它开始为我工作:

$conf['memcache_bins'] = array( 'cache' => 'default',  'cache_form' => 'none', );