use of hry.trade.entrust.model.ExOrderInfo in project benchmark by seelunzi.
the class TradeRedis method setExchangeDataCache.
/* */
/* */
/* */
public static void setExchangeDataCache(List<ExOrderInfo> listExOrderInfo, String header) /* */
{
/* 317 */
RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
/* 318 */
ExOrderInfo exOrderInfo = (ExOrderInfo) listExOrderInfo.get(listExOrderInfo.size() - 1);
/* */
/* 320 */
setStringData(header + ":" + "currentExchangPrice", exOrderInfo.getTransactionPrice().setScale(10, 4).toString());
/* */
/* 322 */
String v = redisService.get(header + ":" + "LastOrderRecords");
/* 323 */
List<ExOrderInfo> list = null;
/* 324 */
if (!StringUtil.isEmpty(v)) {
/* 325 */
list = JSON.parseArray(v, ExOrderInfo.class);
/* */
} else {
/* 327 */
list = new ArrayList();
/* */
}
/* 329 */
list.addAll(listExOrderInfo);
/* 330 */
if (list.size() > ExchangeDataCacheRedis.LastOrderRecordsLmit.intValue()) {
/* 331 */
List<ExOrderInfo> sublist = list.subList(list.size() - ExchangeDataCacheRedis.LastOrderRecordsLmit.intValue(), list.size());
/* 332 */
redisService.save(header + ":" + "LastOrderRecords", JSON.toJSONString(sublist));
/* */
} else {
/* 334 */
redisService.save(header + ":" + "LastOrderRecords", JSON.toJSONString(list));
/* */
}
/* */
}
use of hry.trade.entrust.model.ExOrderInfo in project benchmark by seelunzi.
the class TradeRedis method put.
/* */
/* */
/* */
public static void put(ExOrderInfo exOrderInfo) /* */
{
/* 528 */
RedisService redisService = (RedisService) ContextUtil.getBean("redisService");
/* 529 */
String v = redisService.get("exorderinfos");
/* 530 */
List<ExOrderInfo> list = JSON.parseArray(v, ExOrderInfo.class);
/* 531 */
list.add(exOrderInfo);
/* 532 */
redisService.save("exorderinfos", JSON.toJSONString(list));
/* */
}
Aggregations