重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佸箍鍛婁綅
重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佸畼鏂圭殑gravatar澶村儚

重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佺綉绔欑敤鎴风淇″垪琛ㄩ噰鐢╩ysql union鏌ヨ浼樺寲涓篟edis鏌ヨ鐨勭粡楠屽拰鐩稿叧浠g爜鐗囨鍒嗕韩

鐢变簬鐢ㄦ埛鍜岀淇$殑鏁版嵁閲忛愭笎澧炲姞锛屾煡璇㈢敤鎴峰拰鍏朵粬鐢ㄦ埛鐨勭淇″悎骞舵帓閲嶆帓搴忕殑sql璇硶缁檓ysql甯︽潵浜嗗緢澶х殑鍘嬪姏锛宻pringdata jpa鐨刪ql鏌ヨ璇硶濡備笅锛

select id from (select id,target_id,case when user_id=?1 and type=?2 then 'sender'  else 'receiver' end flag from javaniu_post where user_id=?1 and type=?2  union select id,user_id,case when user_id=?1	then 'sender'  else 'receiver' end flag from javaniu_post where target_id=?1 and type=?2  order by id desc) as ret group by target_id order by id desc

鍦╩ysql鐨剆low鏌ヨ涓粡甯镐細鍑虹幇10s浠ヤ笂鐨勮褰曪細

重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佺綉绔欑敤鎴风淇″垪琛ㄩ噰鐢╩ysql union鏌ヨ浼樺寲涓篟edis鏌ヨ鐨勭粡楠屽拰鐩稿叧浠g爜鐗囨鍒嗕韩

mysql鏌ヨ鎬ц兘鐨勭摱棰堝湪浜庢煇涓敤鎴峰拰鍏朵粬鐢ㄦ埛涔嬮棿浜や簰瓒婂锛屽彂閫佺淇¤秺澶氾紝mysql union鏌ヨ鍙備笌杩愮畻鐨勯泦鍚堟暟鎹噺浼氳秺澶э紝鎬ц兘涔熶細瓒婃潵瓒婁綆銆

鏁版嵁鍙樺寲濡備笅:

1.鐢ㄦ埛A鍙戠粰鐢ㄦ埛B鐢熸垚绉佷俊1

鐢ㄦ埛A->鐢ㄦ埛B->绉佷俊1

2.鐢ㄦ埛A鍙戠粰鐢ㄦ埛C鐢熸垚绉佷俊2

鐢ㄦ埛A->鐢ㄦ埛C->绉佷俊2

3.鐢ㄦ埛A鍙戠粰鐢ㄦ埛E鐢熸垚绉佷俊3

鐢ㄦ埛A->鐢ㄦ埛E->绉佷俊3

4.鏌ヨ鐢ㄦ埛A鐨勭淇″垪琛

绉佷俊3,绉佷俊2锛岀淇1

5.鐢ㄦ埛B鍙戠粰鐢ㄦ埛A鐢熸垚绉佷俊4

鐢ㄦ埛B->鐢ㄦ埛A->绉佷俊4

6.鏌ヨ鐢ㄦ埛A鐨勭淇″垪琛

绉佷俊4,绉佷俊3锛岀淇2

绉佷俊1鍥犱负鏈壷厍炜3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆㈡柊鏁版嵁绉佷俊4鐨勫瓨鍦紝鎵浠ヤ笉浼氳繑鍥炪

鎵浠ヨ揩鍒囬渶瑕佸紩鍏ユ柊鐨勬妧鏈潵瑙e喅璇ユ煡璇㈢殑鎬ц兘鐡堕锛屾兂鍒颁簡娴佽鐨剅edis鎶鏈紝浜庢槸淇敼璁捐濡備笅锛

妯℃嫙鍙戠淇$殑鏁版嵁缁撴瀯濡備笅

127.0.0.1:6379> zadd uid1 1 2
(integer) 1
127.0.0.1:6379> zadd uid1 2 3
(integer) 1
127.0.0.1:6379> zadd uid1 3 5
(integer) 1
127.0.0.1:6379> zrevrange uid1 0 -1
1) "5"
2) "3"
3) "2"
127.0.0.1:6379> zrevrange uid1 0 -1 withscores
1) "5"
2) "3"
3) "3"
4) "2"
5) "2"
6) "1"
127.0.0.1:6379> zadd uid1 4 2
(integer) 0
127.0.0.1:6379> zrevrange uid1 0 -1 withscores
1) "2"
2) "4"
3) "5"
4) "3"
5) "3"
6) "2"
127.0.0.1:6379>

娉ㄦ剰锛氭妸绉佷俊id鍋氫负score鏉ュ仛鎺掑簭

鐩稿叧浠g爜鐗囨濡備笅锛

鍒犻櫎鎴栨坊鍔犵淇℃椂锛

String uid = t.getUserId() + "";
String type = ModuleConstants.POST_TYPE_MESSAGE + "";
String tgid = t.getTargetId() + "";
long id = t.getId();
long time = t.getCreateTime().getTime();

String po_uid_tp_tgid = String.format(
        RedisConstants.POST_USERID_TYPE_TARGETID, uid, type, tgid);
// from uid
String po_uid_tp = String.format(RedisConstants.POST_USERID_TYPE,
        uid, type);
// to uid
String po_tgid_tp = String.format(RedisConstants.POST_USERID_TYPE,
        tgid, type);
if (t.getStatus() == ModuleConstants.MODULE_STATUS_DELETED) {// 鍒犻櫎绉佷俊鍚屾椂瑕佸垹闄edis
    zsetOps.remove(po_uid_tp_tgid, id + "");
    zsetOps.remove(po_uid_tp, tgid);
    zsetOps.remove(po_tgid_tp, uid);
} else {
    zsetOps.add(po_uid_tp_tgid, id + "", time);
    zsetOps.add(po_uid_tp, tgid, id);
    zsetOps.add(po_tgid_tp, uid, id);
}

鏌ヨ鐢ㄦ埛鐨勭淇℃椂锛

String uid = userId + "";
		String tp = ModuleConstants.POST_TYPE_MESSAGE + "";
		String po_uid_tp = String.format(RedisConstants.POST_USERID_TYPE, uid,
				tp);

		int total = zsetOps.zCard(po_uid_tp).intValue();

		int ps = total / count + (total % count > 0 ? 1 : 0);
		if (page > ps) {
			page = ps;
		}
		int start = (page - 1) * count;
		int end = page * count - 1;

		Set<TypedTuple<String>> _ids = zsetOps.reverseRangeWithScores(
				po_uid_tp, start, end);

		List<Long> ids = new ArrayList<Long>();
		Iterator<TypedTuple<String>> iterator = _ids.iterator();
		while (iterator.hasNext()) {
			TypedTuple<String> _id = iterator.next();
			long id = _id.getScore().longValue();
			ids.add(id);
		}
		List<Post> ts = (List<Post>) findAllByIds(ids);
		Pageable pageable = new PageRequest(page - 1, count);
		Page<Post> _page = new PageImpl<Post>(ts, pageable, total);
		initBeans(_page.getContent());

redis鏌ヨ重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佸畼鏂癸紝id=1鐨勬墍鏈夌淇″垪琛紝鍜宮ysql union杩愮畻鐨勭粨鏋滃畬鍏ㄤ竴鑷达紝浣嗘槸鎬ц兘鍙槸澶╁¥涔嬪埆锛

重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佺綉绔欑敤鎴风淇″垪琛ㄩ噰鐢╩ysql union鏌ヨ浼樺寲涓篟edis鏌ヨ鐨勭粡楠屽拰鐩稿叧浠g爜鐗囨鍒嗕韩
info鐨刴emory鎴浘鍜宬eyspace鎴浘

重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佺綉绔欑敤鎴风淇″垪琛ㄩ噰鐢╩ysql union鏌ヨ浼樺寲涓篟edis鏌ヨ鐨勭粡楠屽拰鐩稿叧浠g爜鐗囨鍒嗕韩

重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佺綉绔欑敤鎴风淇″垪琛ㄩ噰鐢╩ysql union鏌ヨ浼樺寲涓篟edis鏌ヨ鐨勭粡楠屽拰鐩稿叧浠g爜鐗囨鍒嗕韩

鐩稿叧璧勬枡鍜屼唬鐮侊細

mysql sql鏌ヨ濡備綍瀹炵幇鍙戠淇$敤鎴峰拰鍏朵粬鐢ㄦ埛鐨勫垪琛紵瑕佹眰娑堥噸鎵鏈夐噸澶嶇殑鐢ㄦ埛缁撴灉

重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佺綉绔欑殑绉佷俊鍔熻兘

鐚滀綘鍠滄

鎵撹祻

重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佒厍炜3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆㈣繎涓嬭浇鍒嗕韩婧愪唬鐮佸垪琛重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆㈣繎涓嬭浇
重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佒厍炜3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆㈣繎娴忚鍒嗕韩婧愪唬鐮佸垪琛重庆快3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆㈣繎娴忚
ncd12320 LV81鏈12鏃
鏈堜寒鏈堜寒
lelelada LV52019骞12鏈16鏃
鏈堜寒鏄熸槦
涓堕檲灏忎簨鍎 LV32019骞12鏈10鏃
鏄熸槦鏄熸槦鏄熸槦
wfqdxdx LV62019骞12鏈5鏃
鏈堜寒鏄熸槦鏄熸槦
鑽夊ご鍏冨竻 LV12019骞11鏈28鏃
鏄熸槦
2426459174 LV22019骞11鏈27鏃
鏄熸槦鏄熸槦
123hdhdhd LV102019骞11鏈27鏃
鏈堜寒鏈堜寒鏄熸槦鏄熸槦
cpla1998 LV62019骞11鏈21鏃
鏈堜寒鏄熸槦鏄熸槦
13232875251 LV142019骞11鏈21鏃
鏈堜寒鏈堜寒鏈堜寒鏄熸槦鏄熸槦
dingjiaqiang LV22019骞11鏈16鏃
鏄熸槦鏄熸槦
椤堕儴瀹㈡湇寰俊浜岀淮鐮搴曢儴
>鎵弿浜岀淮鐮佸叧娉ㄖ厍炜3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佷负濂藉弸鎵弿浜岀淮鐮佸叧娉ㄖ厍炜3平台app下载_閲嶅簡蹇笁app鏈鏂扮増涓嬭浇鈥斾富椤-褰╃粡_褰╁枩娆唬鐮佷负濂藉弸