mongo慢查询修改
parent
8ab6627d3d
commit
9bd09974d9
|
@ -435,10 +435,7 @@ public class AreaManager {
|
|||
int serverId = defaultServerId;
|
||||
Integer serverIdByUid = RedisUtil.getInstence().getMapEntry(RedisKey.CUser_ServerId_Key, "", Integer.toString(uid),
|
||||
Integer.class);
|
||||
if (serverIdByUid != null) {
|
||||
return serverIdByUid;
|
||||
}
|
||||
serverIdByUid = MongoUtil.getInstence().findCUserServerId(uid);
|
||||
// serverIdByUid = MongoUtil.getInstence().findCUserServerId(uid);
|
||||
if (serverIdByUid != null) {
|
||||
serverId = serverIdByUid;
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.CUser_ServerId_Key, "", Integer.toString(uid),
|
||||
|
|
|
@ -271,19 +271,18 @@ public class MongoUtil {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Integer findCUserServerId(int uid){
|
||||
BasicQuery basicQuery = new BasicQuery(new BasicDBObject("uid", uid),new BasicDBObject("serverId", 1));
|
||||
DBObject c_user_info = coreMongoTemplate.findOne(basicQuery, DBObject.class, "user_info");
|
||||
if(c_user_info == null){
|
||||
LOGGER.error("the user={} not exists",uid);
|
||||
return null;
|
||||
}
|
||||
String serverid = (String) c_user_info.get("serverId");
|
||||
|
||||
return Integer.valueOf(serverid);
|
||||
}
|
||||
//慢查询 弃用 lxr
|
||||
// public Integer findCUserServerId(int uid){
|
||||
// BasicQuery basicQuery = new BasicQuery(new BasicDBObject("uid", uid),new BasicDBObject("serverId", 1));
|
||||
// DBObject c_user_info = coreMongoTemplate.findOne(basicQuery, DBObject.class, "user_info");
|
||||
// if(c_user_info == null){
|
||||
// LOGGER.error("the user={} not exists",uid);
|
||||
// return null;
|
||||
// }
|
||||
// String serverid = (String) c_user_info.get("serverId");
|
||||
//
|
||||
// return Integer.valueOf(serverid);
|
||||
// }
|
||||
|
||||
|
||||
public Integer findGuilderverId(int guildId){
|
||||
|
|
Loading…
Reference in New Issue