1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-26 20:52:44 +08:00
2020-01-30 16:51:10 +08:00

36 lines
518 B
PHP

<?php
namespace App\Caches;
use App\Repos\User as UserRepo;
class User extends Cache
{
protected $lifetime = 7 * 86400;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return "user:{$id}";
}
public function getContent($id = null)
{
$userRepo = new UserRepo();
$user = $userRepo->findById($id);
if (!$user) {
return new \stdClass();
}
return $user;
}
}