多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# 组件源码 /** * <b>方法描述:</b> 设置固定过期时间 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 10:34:14 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param millisecondsTimestamp * 入参|过期时间|{@link long} * @return -1 异常<br/> * 0 失败<br/> * 1 成功<br/> */ @Component(label = "设置固定过期时间", style = "判断型", type = "同步组件", comment = "固定的UNIX时间(从1970年开始算起),单位为毫秒", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 10:34:14") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class), @Param(name = "millisecondsTimestamp", comment = "过期时间", type = long.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase P_pexpireAt(String key, long millisecondsTimestamp) { try { if (redisTemplate.expireAt(key, new Date(millisecondsTimestamp))) return ResultBase.newSuccessResult(); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR3012", "设置固定过期时间 异常:" + AppLog.errorMsg(e)); } return ResultBase.newFailureResult("TPTR3013", "设置固定过期时间失败"); } 交易中组件使用方式: ![](https://img.kancloud.cn/0f/4e/0f4ed6606c950eba3eb18facd7baffaa_1258x750.jpg) ## 参数说明及示例 key:redis中存在的key,示例: `"key"` 过期时间:redis中存在的key设置固定的过期时间,单位为毫秒,示例: `1000000` > 固定的UNIX时间(从1970年开始算起),单位为毫秒