Laravel redis缓存标记未清除?

时间:2017-08-01 08:13:13

标签: php laravel caching

在我的Laravel 5.4项目中,我使用redis。我有EloquentRepo.php这些函数:

public function findBy($column, $value, $with = [])
{
    return $this->cache->tags($this->getModel())->remember($this->getModel().'|find_by|'.$column.'|'.$value, 60, function () use ($column, $value, $with) {
        return $this->_model->where($column, $value)->with($with)->first();
    });
}

public function paginate($page, $with = [])
{
    return $this->cache->tags($this->getModel())->remember($this->getModel().'|paginate|'.$page, 60, function () use ($page, $with) {
        return $this->_model
            ->with($with)
            ->paginate(10);
    });
}

$this->cache是对

的引用
use Illuminate\Cache\Repository as CacheRepository;

我有一个带有观察者类的Organisation.php模型。该观察者类中的更新方法如下所示:

public function updated(Organisation $organisation)
{
    $this->cache->tags(Organisation::class)->flush();
    $this->cache->tags(Relation::class)->flush();
}

正在正确刷新组织缓存标记。但是关系缓存标记根本没有被刷新(我可以在redis-cli中看到keys *

我在存储库中使用相同的方法来获取数据,这可能是什么问题?

0 个答案:

没有答案
相关问题