|
|
package com.yohoufo.order.controller;
|
|
|
|
|
|
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
|
|
|
import com.yohobuy.ufo.model.order.common.TabType;
|
|
|
import com.yohoufo.common.ApiResponse;
|
|
|
import com.yohoufo.order.service.cache.CacheCleaner;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
...
|
...
|
@@ -10,6 +12,9 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* Created by chenchao on 2018/10/20.
|
|
|
*/
|
...
|
...
|
@@ -39,4 +44,17 @@ public class CacheRest { |
|
|
cacheCleaner.cleanDetail(uid, orderCode, TabType.getTabType(actor));
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).message("clean order 成功").build();
|
|
|
}
|
|
|
|
|
|
@RequestMapping("/cleanCache")
|
|
|
public ApiResponse cleanCache(@RequestParam("key") String key){
|
|
|
logger.info("in cleanCache, key {}", key);
|
|
|
if (StringUtils.isBlank(key)){
|
|
|
return new ApiResponse.ApiResponseBuilder().code(401).build();
|
|
|
}
|
|
|
RedisKeyBuilder rkb = RedisKeyBuilder.newInstance().appendFixed(key);
|
|
|
List<RedisKeyBuilder> keyBuilders = new ArrayList<>(1);
|
|
|
keyBuilders.add(rkb);
|
|
|
cacheCleaner.delete(keyBuilders);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).message("clean 成功").build();
|
|
|
}
|
|
|
} |
...
|
...
|
|