From 539ebf0be98bd771f12fffafb691f2d89596299c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=B4=AA=E9=BE=99?= <599179587@qq.com> Date: Tue, 1 Aug 2017 18:22:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=88=97=E8=A1=A8=E7=BC=93?= =?UTF-8?q?=E5=AD=98key=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ifish/helper/RedisKeyHelper.java | 85 ++++++++++++++++++- .../com/ifish/helper/RedisKeyHelperI.java | 61 +++++++++++++ src/main/java/com/ifish/util/RedisKey.java | 5 ++ 3 files changed, 147 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ifish/helper/RedisKeyHelper.java b/src/main/java/com/ifish/helper/RedisKeyHelper.java index 8edc4fc..82fbebf 100644 --- a/src/main/java/com/ifish/helper/RedisKeyHelper.java +++ b/src/main/java/com/ifish/helper/RedisKeyHelper.java @@ -10,6 +10,7 @@ import com.ifish.bean.Tbl_Device_Statistics; import com.ifish.bean.Tbl_Device_User; import com.ifish.bean.Tbl_Live_Message; import com.ifish.bean.Tbl_Live_Room; +import com.ifish.bean.Tbl_Push_List; import com.ifish.bean.Tbl_User; import com.ifish.util.RedisKey; import org.apache.commons.lang3.StringUtils; @@ -379,7 +380,7 @@ public class RedisKeyHelper implements RedisKeyHelperI { deleteTbl_DeviceInfo(device); try { Tbl_Device_Statistics device_Statistics = deviceHelper.getDeviceStatisticsByDeviceId(device.getDeviceId()); - deleteRedisByTbl_Device_Statistics(device_Statistics); + deleteTbl_Device_StatisticsInfo(device_Statistics); } catch (Exception e) { } } @@ -407,7 +408,7 @@ public class RedisKeyHelper implements RedisKeyHelperI { deleteTbl_Device_StatisticsInfo(device); try { Tbl_Device device1 = deviceHelper.getDeviceById(device.getDeviceId()); - deleteRedisByTbl_Device(device1); + deleteTbl_DeviceInfo(device1); } catch (Exception e) { } } @@ -432,9 +433,9 @@ public class RedisKeyHelper implements RedisKeyHelperI { deleteTbl_Device_UserInfo(tbl_Device_User); try { Tbl_Device device1 = deviceHelper.getDeviceById(tbl_Device_User.getDeviceId()); - deleteRedisByTbl_Device(device1); + deleteTbl_DeviceInfo(device1); Tbl_Device_Statistics device_Statistics = deviceHelper.getDeviceStatisticsByDeviceId(tbl_Device_User.getDeviceId()); - deleteRedisByTbl_Device_Statistics(device_Statistics); + deleteTbl_Device_StatisticsInfo(device_Statistics); } catch (Exception e) { } } @@ -513,4 +514,80 @@ public class RedisKeyHelper implements RedisKeyHelperI { redisHelperI.delRedisByTagKey(RedisKey.LIVEMESSAGE_ROOMID + tbl_Live_Message.getRoomId()); redisHelperI.deleteRedis(RedisKey.LIVEMESSAGE_COUNT + tbl_Live_Message.getRoomId()); } + + /** + * 后台推送消息列表缓存 + * + * @param start + * @param length + * @param sdkVersion + * @param phoneNumber + * @param mac + * @param phoneType + * @param pushType + * @param sortField + * @param sortMode + * @return + */ + @Override + public String getAdmin_Tbl_Push_List_BySelect(Integer start, Integer length, String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode) { + return RedisKey.PUSHLIST_SELECT + start + "_" + length + "_" + sdkVersion + "_" + phoneNumber + "_" + mac + "_" + phoneType + "_" + pushType + "_" + sortField + "_" + sortMode; + } + + /** + * 后台推送消息列表查询数量缓存 + * + * @param start + * @param length + * @param sdkVersion + * @param phoneNumber + * @param mac + * @param phoneType + * @param pushType + * @param sortField + * @param sortMode + * @return + */ + @Override + public String getAdmin_Tbl_Push_List_Count_BySelect(String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode) { + return RedisKey.PUSHLIST_SELECT + "count_" + sdkVersion + "_" + phoneNumber + "_" + mac + "_" + phoneType + "_" + pushType + "_" + sortField + "_" + sortMode; + } + + /** + * 后台推送消息列表总数缓存 + * + * @param start + * @param length + * @param sdkVersion + * @param phoneNumber + * @param mac + * @param phoneType + * @param pushType + * @param sortField + * @param sortMode + * @return + */ + @Override + public String getAdmin_Tbl_Push_List_AllCount() { + return RedisKey.PUSHLIST_SELECT; + } + + /** + * 根据条件删除推送列表缓存 + * + * @param pushId + */ + public void deleteRedisByTbl_Push_List(Tbl_Push_List tbl_Push_List) { + if (tbl_Push_List.getPushId() != null) { + redisHelperI.deleteRedis(getTbl_Push_List_RedisByPushId(tbl_Push_List.getPushId())); + } + deleteRedisByTbl_Push_ListToAllRedisList(); + } + + /** + * 删除推送列表类缓存 + */ + public void deleteRedisByTbl_Push_ListToAllRedisList() { + redisHelperI.delRedisByTagKey(RedisKey.PUSHLIST_SELECT); + } } diff --git a/src/main/java/com/ifish/helper/RedisKeyHelperI.java b/src/main/java/com/ifish/helper/RedisKeyHelperI.java index 4a3c4c0..78019fc 100644 --- a/src/main/java/com/ifish/helper/RedisKeyHelperI.java +++ b/src/main/java/com/ifish/helper/RedisKeyHelperI.java @@ -10,6 +10,7 @@ import com.ifish.bean.Tbl_Device_Statistics; import com.ifish.bean.Tbl_Device_User; import com.ifish.bean.Tbl_Live_Message; import com.ifish.bean.Tbl_Live_Room; +import com.ifish.bean.Tbl_Push_List; import com.ifish.bean.Tbl_User; /** @@ -257,6 +258,54 @@ public interface RedisKeyHelperI { */ public String getTbl_Push_List_RedisByPushId(Integer pushId); + /** + * 后台推送消息列表缓存 + * + * @param start + * @param length + * @param sdkVersion + * @param phoneNumber + * @param mac + * @param phoneType + * @param pushType + * @param sortField + * @param sortMode + * @return + */ + public String getAdmin_Tbl_Push_List_BySelect(Integer start, Integer length, String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode); + + /** + * 后台推送消息列表查询数量缓存 + * + * @param start + * @param length + * @param sdkVersion + * @param phoneNumber + * @param mac + * @param phoneType + * @param pushType + * @param sortField + * @param sortMode + * @return + */ + public String getAdmin_Tbl_Push_List_Count_BySelect(String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode); + + /** + * 后台推送消息列表总数缓存 + * + * @param start + * @param length + * @param sdkVersion + * @param phoneNumber + * @param mac + * @param phoneType + * @param pushType + * @param sortField + * @param sortMode + * @return + */ + public String getAdmin_Tbl_Push_List_AllCount(); + /** * 根据MD5值获取redis缓存key键值(注册账号用) * @@ -321,4 +370,16 @@ public interface RedisKeyHelperI { * @param tbl_Live_Message */ public void deleteRedisByTbl_Live_Message(Tbl_Live_Message tbl_Live_Message); + + /** + * 根据条件删除推送列表缓存 + * + * @param pushId + */ + public void deleteRedisByTbl_Push_List(Tbl_Push_List tbl_Push_List); + + /** + * 删除推送列表类缓存 + */ + public void deleteRedisByTbl_Push_ListToAllRedisList(); } diff --git a/src/main/java/com/ifish/util/RedisKey.java b/src/main/java/com/ifish/util/RedisKey.java index 4f54dcb..5a3a97f 100644 --- a/src/main/java/com/ifish/util/RedisKey.java +++ b/src/main/java/com/ifish/util/RedisKey.java @@ -134,6 +134,11 @@ public class RedisKey { */ public static final String PUSHLIST_PUSHID = "pushlistE:id_"; + /** + * 后台推送列表缓存条件 + */ + public static final String PUSHLIST_SELECT = "pushlistE:se_"; + /** * 邮箱验证有效缓存key */