| | |
| | | package com.yeshi.fanli.util.cache;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | /**
|
| | | * 金币缓存
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class IntegralGetCacheManager {
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | /**
|
| | | * 缓存商品搜索记录
|
| | | * |
| | | * @param device
|
| | | * @param time
|
| | | */
|
| | | public void cacheSearchGoods(String device, Long time) {
|
| | | redisManager.cacheCommonString("integral-seacrh-goods-" + device, time + "", 60 * 5);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取上次搜索时间
|
| | | * |
| | | * @param device
|
| | | * @return
|
| | | */
|
| | | public Long getLastSearchTime(String device) {
|
| | | String value = redisManager.getCommonString("integral-seacrh-goods-" + device);
|
| | | if (StringUtil.isNullOrEmpty(value))
|
| | | return null;
|
| | | return Long.parseLong(value);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清除设备搜索时间
|
| | | * @param device
|
| | | */
|
| | | public void clearSearchTime(String device) {
|
| | | redisManager.removeCommonString("integral-seacrh-goods-" + device);
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.util.cache; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.yeshi.fanli.util.RedisKeyEnum; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | |
| | | /** |
| | | * 金币缓存 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | @Component |
| | | public class IntegralGetCacheManager { |
| | | |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | /** |
| | | * 缓存商品搜索记录 |
| | | * |
| | | * @param device |
| | | * @param time |
| | | */ |
| | | public void cacheSearchGoods(String device, Long time) { |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.seacrhGoods, device); |
| | | redisManager.cacheCommonString(key, time + "", 60 * 5); |
| | | } |
| | | |
| | | /** |
| | | * 获取上次搜索时间 |
| | | * |
| | | * @param device |
| | | * @return |
| | | */ |
| | | public Long getLastSearchTime(String device) { |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.seacrhGoods, device); |
| | | String value = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(value)) |
| | | return null; |
| | | return Long.parseLong(value); |
| | | } |
| | | |
| | | /** |
| | | * 清除设备搜索时间 |
| | | * @param device |
| | | */ |
| | | public void clearSearchTime(String device) { |
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.seacrhGoods, device); |
| | | redisManager.removeCommonString(key); |
| | | } |
| | | |
| | | } |