ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 组件源码 /** * <b>方法描述:</b> 清空Redis <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2020-06-09 11:51:19 <br/> * * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "清空Redis", style = "判断型", type = "同步组件", comment = "执行flushDb", version = "1.0.0", deprecated = false, author = "admin", date = "2020-06-09 11:51:19") @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_flushDb() { try { redisTemplate.execute(new RedisCallback() { public String doInRedis(RedisConnection connection) throws DataAccessException { connection.flushDb(); return "ok"; } }); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR3004", "清空Redis 异常:" + AppLog.errorMsg(e)); } return ResultBase.newSuccessResult(); } 交易中组件使用方式: ![](https://img.kancloud.cn/87/84/8784bdbd4eebc7500999c06e1e8c099f_1186x1173.jpg) > 执行flushDb