| <?php |
|
|
| namespace Kanboard\Decorator; |
|
|
| use Kanboard\Core\Cache\CacheInterface; |
| use Kanboard\Model\ColumnRestrictionModel; |
|
|
| |
| |
| |
| |
| |
| |
| class ColumnRestrictionCacheDecorator |
| { |
| protected $cachePrefix = 'column_restriction:'; |
|
|
| |
| |
| |
| protected $cache; |
|
|
| |
| |
| |
| protected $columnRestrictionModel; |
|
|
| |
| |
| |
| |
| |
| |
| public function __construct(CacheInterface $cache, ColumnRestrictionModel $columnMoveRestrictionModel) |
| { |
| $this->cache = $cache; |
| $this->columnRestrictionModel = $columnMoveRestrictionModel; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function getAllByRole($project_id, $role) |
| { |
| $key = $this->cachePrefix.$project_id.$role; |
| $columnRestrictions = $this->cache->get($key); |
|
|
| if ($columnRestrictions === null) { |
| $columnRestrictions = $this->columnRestrictionModel->getAllByRole($project_id, $role); |
| $this->cache->set($key, $columnRestrictions); |
| } |
|
|
| return $columnRestrictions; |
| } |
| } |
|
|