1 | <?php |
||
15 | class Cache implements RobotsTxtInterface |
||
16 | { |
||
17 | use UriParser; |
||
18 | |||
19 | /** |
||
20 | * Client nextUpdate margin in seconds |
||
21 | * @var int |
||
22 | */ |
||
23 | protected $clientUpdateBuffer = 300; |
||
24 | |||
25 | /** |
||
26 | * Handler |
||
27 | * @var ManagerInterface |
||
28 | */ |
||
29 | private $handler; |
||
30 | |||
31 | /** |
||
32 | * Cache constructor. |
||
33 | * |
||
34 | * @param PDO $pdo |
||
35 | * @param array $curlOptions |
||
36 | * @param int|null $byteLimit |
||
37 | */ |
||
38 | public function __construct(PDO $pdo, array $curlOptions = [], $byteLimit = self::BYTE_LIMIT) |
||
43 | |||
44 | /** |
||
45 | * Parser client |
||
46 | * |
||
47 | * @param string $baseUri |
||
48 | * @return TxtClient |
||
49 | */ |
||
50 | public function client($baseUri) |
||
54 | |||
55 | /** |
||
56 | * Process the update queue |
||
57 | * |
||
58 | * @param float|int $targetTime |
||
59 | * @param int|null $workerID |
||
60 | * @return string[] |
||
61 | */ |
||
62 | public function cron($targetTime = 60, $workerID = null) |
||
66 | |||
67 | /** |
||
68 | * Clean the cache table |
||
69 | * |
||
70 | * @param int $delay - in seconds |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function clean($delay = 900) |
||
77 | |||
78 | /** |
||
79 | * Invalidate cache |
||
80 | * |
||
81 | * @param $baseUri |
||
82 | * @return bool |
||
83 | */ |
||
84 | public function invalidate($baseUri) |
||
88 | } |
||
89 |