Update source into github
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace App\Repositories\Module\Domain;
|
||||
|
||||
use App\Repositories\BaseCachedRepository;
|
||||
use App\Repositories\Module\Domain\DomainRepository;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class DomainCachedRepository extends BaseCachedRepository implements DomainRepositoryInterface
|
||||
{
|
||||
public function __construct(
|
||||
public DomainRepository $domainRepository
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
public function getModel()
|
||||
{
|
||||
return $this->domainRepository->getModel();
|
||||
}
|
||||
public function filter(array $data = [], array $relationships = [], array $withCount = [], array $select = ['*'])
|
||||
{
|
||||
$cacheKey = $this->getCacheKey(md5(json_encode([
|
||||
'filterItem' => [
|
||||
'data' => $data,
|
||||
'relationships' => $relationships,
|
||||
'select' => $select,
|
||||
'withCount' => $withCount
|
||||
]
|
||||
])));
|
||||
return Cache::remember($cacheKey, $this->cacheTime, function () use ($data, $relationships, $select, $withCount) {
|
||||
return $this->domainRepository->filter($data, $relationships, $withCount, $select);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user