MCPcopy Create free account
hub / github.com/Rfym21/Qwen2API / checkKeyExists

Function checkKeyExists

src/utils/redis.js:527–540  ·  view source on GitHub ↗
(key = 'headers')

Source from the content-addressed store, hash-verified

525 } catch (err) {
526 logger.error('保存运行时设置失败', 'REDIS', '', err)
527 return false
528 }
529}
530
531/**
532 * 检查键是否存在
533 * @param {string} key - 键名
534 * @returns {Promise<boolean>} 键是否存在
535 */
536const checkKeyExists = async (key = 'headers') => {
537 try {
538 const client = await ensureConnection()
539
540 const exists = await client.exists(key)
541 const result = exists === 1
542
543 logger.info(`键 "${key}" ${result ? '存在' : '不存在'}`, 'REDIS', result ? '✅' : '❌')

Callers

nothing calls this directly

Calls 3

ensureConnectionFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected