mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-30 06:11:38 +08:00
34 lines
523 B
PHP
34 lines
523 B
PHP
<?php
|
|
|
|
namespace App\Caches;
|
|
|
|
class AccessToken extends Cache
|
|
{
|
|
|
|
protected $lifetime = 2 * 3600;
|
|
|
|
public function getLifetime()
|
|
{
|
|
return $this->lifetime;
|
|
}
|
|
|
|
public function getKey($id = null)
|
|
{
|
|
return "access_token:{$id}";
|
|
}
|
|
|
|
public function getContent($id = null)
|
|
{
|
|
$categoryRepo = new CategoryRepo();
|
|
|
|
$category = $categoryRepo->findById($id);
|
|
|
|
if (!$category) {
|
|
return new \stdClass();
|
|
}
|
|
|
|
return $category;
|
|
}
|
|
|
|
}
|