企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 /** * <b>方法描述:</b> 剩余存活时间(秒) <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 10:34:32 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param tiem * 出参|剩余时间|{@link long} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "剩余存活时间(秒)", style = "判断型", type = "同步组件", comment = "key还可以存活时间,单位秒;key本来并没有设置过期时间,则返回-1,如果该key不存在,则返回-2", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 10:34:32") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class) }) @OutParams(param = { @Param(name = "tiem", comment = "剩余时间", type = long.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_ttl(String key) { try { return ResultBase.newSuccessResult(redisTemplate.getExpire(key)); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR3014", "剩余存活时间(秒) 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/56/f1/56f114b45e94b232b01ca957b1ac4f0d_1077x750.jpg) ## 参数说明及示例 key:redis中存在的key,示例: `"key"` 剩余时间:redis中存在的key剩余存活时间,单位为秒,示例: `__INNER__["time"]` > key还可以存活时间,单位秒;key本来并没有设置过期时间,则返回-1,如果该key不存在,则返回-2