💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 组件源码 /** * <b>方法描述:</b> 取消过期时间 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 10:33:17 <br/> * * @param key * 入参|key|{@link java.lang.String} * @return -1 异常<br/> * 0 失败<br/> * 1 成功<br/> */ @Component(label = "取消过期时间", style = "判断型", type = "同步组件", comment = "key设置了过期时间,则取消其过期时间,使其永久存在" + ".", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 10:33:17") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase P_persist(String key) { try { if (redisTemplate.persist(key)) return ResultBase.newSuccessResult(); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR3007", "取消过期时间 异常:" + AppLog.errorMsg(e)); } return ResultBase.newFailureResult("TPTR3008", "key取消过期时间失败"); } 交易中组件使用方式: ![](https://img.kancloud.cn/1c/44/1c44a4463b5623424ed7a9a464d25359_1055x1150.jpg) ## 参数说明及示例 key:redis中存在的key,示例: `"oldKey"` > key设置了过期时间,则取消其过期时间,使其永久存在.