package com.lipeng;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SessionCallback;
public class UserSerivce {
private RedisTemplate redisTemplate;
HashOperations ho;
public UserSerivce() {
/**
*
*/
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext-redis.xml");
redisTemplate = (RedisTemplate) ac.getBean("redisTemplate");
}
/**
*
*
* @param uId
* @param pId
*/
public void addLove(String uId, String pId) {
//
final String uKey = getUKey(uId);
final String uHashKey = pId + "";
final String pKey = getPKey(pId);
final String pHashKey = uId + "";
final Date date = new Date();
SessionCallback