Closed guoliang1994 closed 2 years ago
When I use it in workerman, the data I get is always the same,What should I do if I want to get a new instance.
$policy = Enforcer::getPolicy();
Even if my database has been updated, this method always returns the old data,
The following method is singleton mode
/** * Attempt to get the enforcer from the local cache. * * @param string $name * * @return \Casbin\Enforcer * * @throws \InvalidArgumentException */ public function guard($name = null) { $name = $name ?: $this->getDefaultGuard(); if (!isset($this->guards[$name])) { $this->guards[$name] = $this->resolve($name); } return $this->guards[$name]; }
@basakest @techoner
@techoner @basakest
@guoliang1994 Workman is multi-process, we need to use watcher to synchronize : https://github.com/php-casbin/workerman-redis-watcher
When I use it in workerman, the data I get is always the same,What should I do if I want to get a new instance.
The following method is singleton mode