YohoRedisService.java 760 Bytes
package com.yoho.yhmessage.redis;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.yoho.core.redis.YHListOperations;
import com.yoho.core.redis.YHRedisTemplate;

/**
 * yoho主从同步redis
 * @author hugufei
 */

@Service
public class YohoRedisService {

	@Resource(name = "yhRedisTemplate")
	private YHRedisTemplate<String, String> yhRedisTemplate;
	@Resource(name = "yhListOperations")
	private YHListOperations<String, String> yhListOperations;
	
	public long list_size(String redisKey) {
		return yhListOperations.size(redisKey);
	}
	
	public List<String> list_range(String redisKey, int formIndex, int toIndex) {
		return yhListOperations.range(redisKey, formIndex, toIndex);
	}
	
}