CacheKey.php 446 B

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