2020-01-11 13:36:52 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Utils;
|
|
|
|
|
|
|
|
class CacheKey
|
|
|
|
{
|
2020-03-13 14:32:36 +08:00
|
|
|
CONST KEYS = [
|
|
|
|
'EMAIL_VERIFY_CODE' => '邮箱验证吗',
|
2020-06-05 00:25:15 +08:00
|
|
|
'LAST_SEND_EMAIL_VERIFY_TIMESTAMP' => '最后一次发送邮箱验证码时间',
|
|
|
|
'SERVER_STAT' => '节点统计信息'
|
2020-03-13 14:32:36 +08:00
|
|
|
];
|
2020-01-11 13:36:52 +08:00
|
|
|
|
2020-03-13 14:37:28 +08:00
|
|
|
public static function get(string $key, $uniqueValue)
|
2020-03-13 14:32:36 +08:00
|
|
|
{
|
|
|
|
if (!in_array($key, array_keys(self::KEYS))) {
|
|
|
|
abort(500, 'key is not in cache key list');
|
|
|
|
}
|
|
|
|
return $key . '_' . $uniqueValue;
|
|
|
|
}
|
2020-01-11 13:36:52 +08:00
|
|
|
}
|