CacheKey.php 562 B

123456789101112131415161718192021
  1. <?php
  2. namespace App\Utils;
  3. class CacheKey
  4. {
  5. CONST KEYS = [
  6. 'EMAIL_VERIFY_CODE' => '邮箱验证吗',
  7. 'LAST_SEND_EMAIL_VERIFY_TIMESTAMP' => '最后一次发送邮箱验证码时间',
  8. 'SERVER_ONLINE_USER' => '节点在线用户',
  9. 'SERVER_LAST_CHECK_AT' => '节点最后检查时间'
  10. ];
  11. public static function get(string $key, $uniqueValue)
  12. {
  13. if (!in_array($key, array_keys(self::KEYS))) {
  14. abort(500, 'key is not in cache key list');
  15. }
  16. return $key . '_' . $uniqueValue;
  17. }
  18. }