|
|
<?php |
|
|
|
|
|
namespace Kanboard\Decorator; |
|
|
|
|
|
use Kanboard\Core\Cache\CacheInterface; |
|
|
use Kanboard\Model\ColumnMoveRestrictionModel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ColumnMoveRestrictionCacheDecorator |
|
|
{ |
|
|
protected $cachePrefix = 'column_move_restriction:'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $cache; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected $columnMoveRestrictionModel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct(CacheInterface $cache, ColumnMoveRestrictionModel $columnMoveRestrictionModel) |
|
|
{ |
|
|
$this->cache = $cache; |
|
|
$this->columnMoveRestrictionModel = $columnMoveRestrictionModel; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getSortableColumns($project_id, $role) |
|
|
{ |
|
|
$key = $this->cachePrefix.$project_id.$role; |
|
|
$columnIds = $this->cache->get($key); |
|
|
|
|
|
if ($columnIds === null) { |
|
|
$columnIds = $this->columnMoveRestrictionModel->getSortableColumns($project_id, $role); |
|
|
$this->cache->set($key, $columnIds); |
|
|
} |
|
|
|
|
|
return $columnIds; |
|
|
} |
|
|
} |
|
|
|