-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
syncsIn.php
51 lines (39 loc) · 980 Bytes
/
syncsIn.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
use Appwrite\Resque\Worker;
use Utopia\Cache\Adapter\Redis as RedisCache;
use Utopia\Cache\Cache;
use Utopia\CLI\Console;
require_once __DIR__ . '/../init.php';
Console::title('Syncs in V1 Worker');
Console::success(APP_NAME . ' syncs in worker v1 has started');
class SyncsInV1 extends Worker
{
protected array $errors = [];
public function getName(): string
{
return "syncs-in";
}
public function init(): void
{
}
public function run(): void
{
if (!empty($this->args['key'])) {
//var_dump('Purging -> ' . $this->args['key'] . ' from Redis cache');
$this->getCache()->purge($this->args['key']);
}
}
/**
* Get cache
* @return RedisCache
* @throws Exception
*/
private function getCache(): RedisCache
{
global $register;
return new RedisCache($register->get('cache'));
}
public function shutdown(): void
{
}
}