package com.ag.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.stereotype.Repository;
import redis.clients.jedis.JedisPoolConfig;

/**
 * @description: jedis连接工厂代理
 * @author: WangN
 * @create: 2019-09-18
 */
@Repository
public class JedisConnectionFactoryProxy extends JedisConnectionFactory {

    @Autowired
    private JedisConnectionFactory jedisConnectionFactory;

    @Override
    public RedisConnection getConnection() {
        return jedisConnectionFactory.getConnection();
    }

    @Override
    public String getHostName() {
        return jedisConnectionFactory.getHostName();
    }

    @Override
    public void setHostName(String hostName) {
        jedisConnectionFactory.setHostName(hostName);
    }

    @Override
    public String getPassword() {
        return jedisConnectionFactory.getPassword();
    }

    @Override
    public void setPassword(String password) {
        jedisConnectionFactory.setPassword(password);
    }

    @Override
    public int getPort() {
        return jedisConnectionFactory.getPort();
    }

    @Override
    public void setPort(int port) {
        jedisConnectionFactory.setPort(port);
    }

    @Override
    public JedisPoolConfig getPoolConfig() {
        return jedisConnectionFactory.getPoolConfig();
    }

    @Override
    public void setPoolConfig(JedisPoolConfig poolConfig) {
        jedisConnectionFactory.setPoolConfig(poolConfig);
    }

    @Override
    public int getDatabase() {
        return jedisConnectionFactory.getDatabase();
    }

    @Override
    public void setDatabase(int index) {
        jedisConnectionFactory.setDatabase(index);
    }
}
