💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 组件源码 /** * <b>方法描述:</b> 加1 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 09:39:44 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param newvalue * 出参|计算后的新值|{@link long} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "加1", style = "判断型", type = "同步组件", comment = "指定key的值加1;反回新值,key不存在,设置为0在执行操作", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 09:39:44") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class) }) @OutParams(param = { @Param(name = "newvalue", comment = "计算后的新值", type = long.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_incr(String key) { try { Long v = redisTemplate.opsForValue().increment(key); return ResultBase.newSuccessResult(v); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR0004", "加1 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/61/c5/61c513d7423175f7ae1c74781acde10e_1020x750.jpg) ## 参数说明及示例 key:redis中的key,示例: `"qwer"` 计算后的新值:redis的值加1后的结果,示例: `__INNER__["result"]` > 指定key的值加1;反回新值,key不存在,设置为0在执行操作