mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-26 20:52:44 +08:00
34 lines
568 B
PHP
34 lines
568 B
PHP
<?php
|
|
|
|
namespace App\Caches;
|
|
|
|
use App\Repos\CourseUser as CourseUserRepo;
|
|
|
|
class CourseUser extends Cache
|
|
{
|
|
|
|
protected $lifetime = 1 * 86400;
|
|
|
|
public function getLifetime()
|
|
{
|
|
return $this->lifetime;
|
|
}
|
|
|
|
public function getKey($id = null)
|
|
{
|
|
return "course_user:{$id}";
|
|
}
|
|
|
|
public function getContent($id = null)
|
|
{
|
|
list($courseId, $userId) = explode('_', $id);
|
|
|
|
$repo = new CourseUserRepo();
|
|
|
|
$courseUser = $repo->findCourseUser($courseId, $userId);
|
|
|
|
return $courseUser ?: null;
|
|
}
|
|
|
|
}
|