31 lines
962 B
JavaScript
31 lines
962 B
JavaScript
import redis from './redis/index.js';
|
|
|
|
const REDIS_COZE_TOKEN_KEY = 'coze:api:token';
|
|
const REDIS_COZE_EXPIRE_KEY = 'coze:api:expireTime';
|
|
|
|
console.log('=== 清除 Coze Redis Token 缓存 ===\n');
|
|
|
|
async function clearCozeTokens() {
|
|
try {
|
|
console.log('正在连接 Redis...');
|
|
|
|
console.log('清除 token 键:', REDIS_COZE_TOKEN_KEY);
|
|
const tokenDeleted = await redis.del(REDIS_COZE_TOKEN_KEY);
|
|
console.log(` token 删除结果: ${tokenDeleted}`);
|
|
|
|
console.log('清除过期时间键:', REDIS_COZE_EXPIRE_KEY);
|
|
const expireDeleted = await redis.del(REDIS_COZE_EXPIRE_KEY);
|
|
console.log(` 过期时间删除结果: ${expireDeleted}`);
|
|
|
|
console.log('\n✓ Coze token 缓存已成功清除');
|
|
console.log('\n下次请求时会自动重新生成新的 token');
|
|
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('\n✗ 清除 token 缓存失败:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
clearCozeTokens();
|