Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
+35
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Pdp\Storage;
|
||||
|
||||
use Pdp\PublicSuffixList;
|
||||
|
||||
final class RulesStorage implements PublicSuffixListStorage
|
||||
{
|
||||
public function __construct(
|
||||
private readonly PublicSuffixListCache $cache,
|
||||
private readonly PublicSuffixListClient $client
|
||||
) {
|
||||
}
|
||||
|
||||
public function get(string $uri): PublicSuffixList
|
||||
{
|
||||
$publicSuffixList = $this->cache->fetch($uri);
|
||||
if (null !== $publicSuffixList) {
|
||||
return $publicSuffixList;
|
||||
}
|
||||
|
||||
$publicSuffixList = $this->client->get($uri);
|
||||
|
||||
$this->cache->remember($uri, $publicSuffixList);
|
||||
|
||||
return $publicSuffixList;
|
||||
}
|
||||
|
||||
public function delete(string $uri): bool
|
||||
{
|
||||
return $this->cache->forget($uri);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user