package com.gxx.record.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import com.gxx.record.service.RedisService;
/**
*
* - Title:
* -
* redis服务实现类
*
* - Description:
* -
*
none
*
*
*
* @author Administrator
* @version 1.0, 2015年7月19日
* @since record
*
*/
@Service("redisService")
public class RedisServiceImpl implements RedisService {
@Autowired
private RedisTemplate redisTemplate;
/**
* set
* @param key
* @param value
* @return
*/
public boolean set(String key, Object value) {
redisTemplate.opsForValue().set(key, value);
return Boolean.TRUE.booleanValue();
}
/**
* get
* @param key
* @return
*/
public Object get(String key) {
return redisTemplate.opsForValue().get(key);
}
/**
* delete
* @param key
* @return
*/
public Object delete(String key) {
Object object = redisTemplate.opsForValue().get(key);
if( object!=null){
redisTemplate.delete(key);
}
return object;
}
/**
* listLeftPush
* @param key
* @return
*/
public long listLeftPush(String key, String url) {
long size = redisTemplate.opsForList().leftPush(key, url);
return size;
}
/**
* listRightPush
* @param key
* @return
*/
public long listRightPush(String key, String url) {
long size = redisTemplate.opsForList().rightPush(key, url);
return size;
}
/**
* listRange
* @param key
* @return
*/
public List