Update source into github
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Module\DnsServer;
|
||||
|
||||
use App\Repositories\BaseCachedRepository;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class DnsServerCachedRepository extends BaseCachedRepository implements DnsServerRepositoryInterface
|
||||
{
|
||||
public function __construct(
|
||||
public DnsServerRepository $dnsServerRepository
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
public function getModel()
|
||||
{
|
||||
return $this->dnsServerRepository->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->dnsServerRepository->filter($data, $relationships, $withCount, $select);
|
||||
});
|
||||
}
|
||||
public function findByName(string $name = '')
|
||||
{
|
||||
$cacheKey = $this->getCacheKey(md5(json_encode([
|
||||
'findByName' => [
|
||||
'name' => $name
|
||||
]
|
||||
])));
|
||||
return Cache::remember($cacheKey, $this->cacheTime, function () use ($name){
|
||||
return $this->dnsServerRepository->findByName($name);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user