🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 组件源码 /** * <b>方法描述:</b> 字符串追加值 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2020-06-09 17:52:14 <br/> * * @param key * 入参|追加key|{@link java.lang.String} * @param value * 入参|追加值|{@link java.lang.String} * @param value * 出参|追加后最新值长度|int * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "字符串追加值", style = "判断型", type = "同步组件", comment = "将value追加到原有字符串的末尾。若key不存在,则创建一个新值为value的字符串", version = "1.0.0", deprecated = false, author = "admin", date = "2020-06-09 05:52:14") @InParams(param = { @Param(name = "key", comment = "追加key", type = java.lang.String.class), @Param(name = "value", comment = "追加值", type = java.lang.String.class) }) @OutParams(param = { @Param(name = "value", comment = "追加后最新值长度", type = int.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_append(String key, String value) { try { int length = redisTemplate.opsForValue().append(key, value); return ResultBase.newSuccessResult(length); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR5006", "字符串追加值 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/f3/86/f386e206e2e80fe7591771b3bbb06488_950x750.jpg) ## 参数说明及示例 追加key:redis中的key,示例: `"qwer"` 追加值:需要追加的值,示例: `"ceshi"` 追加后最新值长度:追加后,最新的字符串长度,示例: `__INNER__["len"]` > 将value追加到原有字符串的末尾。若key不存在,则创建一个新值为value的字符串