Skip to content

Commit 53e41fe

Browse files
committed
feature:add AsyncTaskAcquirer
1 parent ff4ff35 commit 53e41fe

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/main/AsyncTaskAcquirer.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace cathy\AsyncTask\main;
4+
5+
use Exception;
6+
use think\facade\Cache;
7+
8+
/**
9+
* 异步任务获取器
10+
*/
11+
class AsyncTaskAcquirer
12+
{
13+
/**
14+
* @throws Exception
15+
*/
16+
public static function get($taskKey) {
17+
$taskKey = 'async_task_'.$taskKey;
18+
if (Cache::has($taskKey)) {
19+
throw new Exception('任务不存在');
20+
}
21+
return Cache::get($taskKey);
22+
}
23+
}

0 commit comments

Comments
 (0)