2026-07-25 01:24:08 +08:00

13 lines
391 B
JavaScript

const Controller = require('egg').Controller;
class RedisTestController extends Controller {
async index() {
const { app } = this;
// 测试 Redis 连接
const result = await app.redis.set('test_key', 'Hello, Redis!');
const value = await app.redis.get('test_key');
this.ctx.body = `Redis 测试成功,值为:${value}`;
}
}
module.exports = RedisTestController;