mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-22 19:44:02 +08:00
36 lines
538 B
PHP
36 lines
538 B
PHP
<?php
|
|
|
|
namespace App\Caches;
|
|
|
|
use App\Repos\Course as CourseRepo;
|
|
|
|
class Course extends Cache
|
|
{
|
|
|
|
protected $lifetime = 7 * 86400;
|
|
|
|
public function getLifetime()
|
|
{
|
|
return $this->lifetime;
|
|
}
|
|
|
|
public function getKey($id = null)
|
|
{
|
|
return "course:{$id}";
|
|
}
|
|
|
|
public function getContent($id = null)
|
|
{
|
|
$courseRepo = new CourseRepo();
|
|
|
|
$course = $courseRepo->findById($id);
|
|
|
|
if (!$course) {
|
|
return new \stdClass();
|
|
}
|
|
|
|
return $course;
|
|
}
|
|
|
|
}
|