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