|
@@ -15,12 +15,16 @@ import com.fdkk.fdkkmeta.domain.entity.mysql.RoomEntity;
|
|
|
import com.fdkk.fdkkmeta.domain.entity.mysql.RotateFrameEntity;
|
|
|
import com.fdkk.fdkkmeta.domain.po.AnglePO;
|
|
|
import com.fdkk.fdkkmeta.domain.po.PointPO;
|
|
|
+import com.fdkk.fdkkmeta.grpc.RotateRequest;
|
|
|
import com.fdkk.fdkkmeta.redis.RedisCache;
|
|
|
+import com.fdkk.fdkkmeta.redis.RedisPublishService;
|
|
|
import com.fdkk.fdkkmeta.service.BreakpointsService;
|
|
|
import com.fdkk.fdkkmeta.service.MoveFrameService;
|
|
|
import com.fdkk.fdkkmeta.service.RoomService;
|
|
|
import com.fdkk.fdkkmeta.service.RotateFrameService;
|
|
|
+import com.fdkk.fdkkmeta.util.ProtoJsonUtils;
|
|
|
import com.google.gson.JsonObject;
|
|
|
+import constants.RedisQueueConstant;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
@@ -30,6 +34,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.awt.geom.AffineTransform;
|
|
|
import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.*;
|
|
@@ -48,6 +53,10 @@ public class DevController {
|
|
|
MoveFrameService moveFrameService;
|
|
|
@Autowired
|
|
|
RedisCache redisCache;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RedisPublishService redisPublishService;
|
|
|
+
|
|
|
/**
|
|
|
* test
|
|
|
*
|
|
@@ -156,25 +165,15 @@ public class DevController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("redis")
|
|
|
- public void testredis(String userId,Object value){
|
|
|
- redisCache.pfremove("setCacheRequest:rotate:"+1);
|
|
|
- redisCache.setCacheList("setCacheRequest:rotate:"+1, Arrays.asList(1));
|
|
|
- redisCache.setCacheList("setCacheRequest:rotate:"+1, Arrays.asList(2));
|
|
|
- redisCache.setCacheList("setCacheRequest:rotate:"+1, Arrays.asList(3));
|
|
|
- redisCache.setCacheList("setCacheRequest:rotate:"+1, Arrays.asList(4));
|
|
|
- redisCache.setCacheList("setCacheRequest:rotate:"+1, Arrays.asList(5));
|
|
|
- redisCache.setCacheList("setCacheRequest:rotate:"+1, Arrays.asList(6));
|
|
|
- redisCache.setCacheList("setCacheRequest:rotate:"+1, Arrays.asList(7));
|
|
|
- redisCache.setCacheList("setCacheRequest:rotate:"+1, Arrays.asList(8));
|
|
|
+ public void testredis(String userId,Object value) throws IOException, InterruptedException {
|
|
|
|
|
|
- List<Object> cacheList = redisCache.getCacheList("setCacheRequest:rotate:" + 1);
|
|
|
|
|
|
- List<Object> cacheList1 = redisCache.getCacheList("setCacheRequest:rotate:" + 1);
|
|
|
+ for (int i = 0; i < 10000; i++) {
|
|
|
+ RotateRequest.Builder builder = RotateRequest.newBuilder();
|
|
|
+ builder.setUserId("u_"+i);
|
|
|
+ redisPublishService.sendProtocolMessage(RedisQueueConstant.ROTATE_QUEUE,builder);
|
|
|
|
|
|
- redisCache.lTrim("setCacheRequest:rotate:"+1, 1,-1);
|
|
|
- List<Object> cacheList2 = redisCache.getCacheList("setCacheRequest:rotate:" + 1);
|
|
|
-
|
|
|
- System.out.println(cacheList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|