add redisson
This commit is contained in:
parent
39147d580f
commit
07698931c0
@ -21,9 +21,9 @@ yo.fs.datasource.username=freeswitch
|
||||
yo.fs.datasource.password=RR!h5IpirsnJ
|
||||
|
||||
# Redis
|
||||
yo.redis.host=172.16.92.232
|
||||
yo.redis.port=6379
|
||||
yo.redis.password=123456
|
||||
spring.redis.host=172.16.92.232
|
||||
spring.redis.port=6379
|
||||
spring.redis.password=123456
|
||||
|
||||
# CAS
|
||||
tigon.shiro.cas.server.addr=https://cas.wacai.com
|
||||
|
@ -19,9 +19,9 @@ yo.fs.datasource.username=freeswitch
|
||||
yo.fs.datasource.password=RR!h5IpirsnJ
|
||||
|
||||
# Redis
|
||||
yo.redis.host=172.16.92.232
|
||||
yo.redis.port=6379
|
||||
yo.redis.password=123456
|
||||
spring.redis.host=172.16.92.232
|
||||
spring.redis.port=6379
|
||||
spring.redis.password=123456
|
||||
|
||||
# Dubbo
|
||||
|
||||
|
@ -6,6 +6,6 @@ yo.datasource.username=yoqw
|
||||
yo.datasource.password=yoqw_query!
|
||||
|
||||
# Redis
|
||||
yo.redis.host=172.16.92.232
|
||||
yo.redis.port=6379
|
||||
yo.redis.password=123456
|
||||
spring.redis.host=172.16.92.232
|
||||
spring.redis.port=6379
|
||||
spring.redis.password=123456
|
||||
|
@ -1,7 +1,7 @@
|
||||
spring.application.name=yo-mybatis-cache
|
||||
|
||||
# Redis
|
||||
yo.redis.host=172.16.92.232
|
||||
yo.redis.port=6379
|
||||
yo.redis.password=123456
|
||||
spring.redis.host=172.16.92.232
|
||||
spring.redis.port=6379
|
||||
spring.redis.password=123456
|
||||
|
||||
|
@ -1,5 +1,2 @@
|
||||
spring.application.name=YO_REDIS
|
||||
spring.application.name=yo-redis
|
||||
|
||||
# Redis Cluster
|
||||
yo.redis-cluster.app-id=10003
|
||||
yo.redis-cluster.app-key=d7317ef13ea37c03f87fcd214755b341
|
||||
|
@ -33,6 +33,11 @@
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||
<version>3.13.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
@ -45,18 +50,19 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>spring-boot-starter-logging</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -9,31 +9,31 @@
|
||||
|
||||
<!-- Redis Tpl -->
|
||||
<bean id="redisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
|
||||
p:host-name="${yo.redis.host}"
|
||||
p:port="${yo.redis.port:6379}"
|
||||
p:password="${yo.redis.password:#{null}}"
|
||||
p:database="${yo.redis.database:0}">
|
||||
p:host-name="${spring.redis.host:localhost}"
|
||||
p:port="${spring.redis.port:6379}"
|
||||
p:password="${spring.redis.password:#{null}}"
|
||||
p:database="${spring.redis.database:0}">
|
||||
<constructor-arg>
|
||||
<bean class="redis.clients.jedis.JedisPoolConfig"
|
||||
p:maxTotal="${yo.redis.max-total:8}"
|
||||
p:maxIdle="${yo.redis.max-idle:8}"
|
||||
p:minIdle="${yo.redis.min-idle:0}"
|
||||
p:testWhileIdle="${yo.redis.test-while-idle:true}"
|
||||
p:maxWaitMillis="${yo.redis.max-wait-millis:-1}"
|
||||
p:blockWhenExhausted="${yo.redis.block-when-exhausted:true}"
|
||||
p:testOnBorrow="${yo.redis.test-on-borrow:false}"
|
||||
p:testOnCreate="${yo.redis.test-on-create:false}"
|
||||
p:testOnReturn="${yo.redis.test-on-return:false}"
|
||||
p:numTestsPerEvictionRun="${yo.redis.num-tests-per-eviction-run:3}"
|
||||
p:evictionPolicyClassName="${yo.redis.eviction-policy-class-name:org.apache.commons.pool2.impl.DefaultEvictionPolicy}"
|
||||
p:fairness="${yo.redis.fairness:false}"
|
||||
p:jmxEnabled="${yo.redis.jmx-enabled:true}"
|
||||
p:lifo="${yo.redis.lifo:true}"
|
||||
p:minEvictableIdleTimeMillis="${yo.redis.min-evictable-idle-time-millis:1800000}"
|
||||
p:softMinEvictableIdleTimeMillis="${yo.redis.soft-min-evictable-idle-time-millis:1800000}"
|
||||
p:timeBetweenEvictionRunsMillis="${yo.redis.time-between-eviction-runs-millis:-1}"
|
||||
p:jmxNameBase="${yo.redis.jmx-name-base:#{null}}"
|
||||
p:jmxNamePrefix="${yo.redis.jmx-name-prefix:pool}"
|
||||
p:maxTotal="${spring.redis.pool.max-total:8}"
|
||||
p:maxIdle="${spring.redis.pool.max-idle:8}"
|
||||
p:minIdle="${spring.redis.pool.min-idle:0}"
|
||||
p:testWhileIdle="${spring.redis.pool.test-while-idle:true}"
|
||||
p:maxWaitMillis="${spring.redis.pool.max-wait-millis:-1}"
|
||||
p:blockWhenExhausted="${spring.redis.pool.block-when-exhausted:true}"
|
||||
p:testOnBorrow="${spring.redis.pool.test-on-borrow:false}"
|
||||
p:testOnCreate="${spring.redis.pool.test-on-create:false}"
|
||||
p:testOnReturn="${spring.redis.pool.test-on-return:false}"
|
||||
p:numTestsPerEvictionRun="${spring.redis.pool.num-tests-per-eviction-run:3}"
|
||||
p:evictionPolicyClassName="${spring.redis.pool.eviction-policy-class-name:org.apache.commons.pool2.impl.DefaultEvictionPolicy}"
|
||||
p:fairness="${spring.redis.pool.fairness:false}"
|
||||
p:jmxEnabled="${spring.redis.pool.jmx-enabled:true}"
|
||||
p:lifo="${spring.redis.pool.lifo:true}"
|
||||
p:minEvictableIdleTimeMillis="${spring.redis.pool.min-evictable-idle-time-millis:1800000}"
|
||||
p:softMinEvictableIdleTimeMillis="${spring.redis.pool.soft-min-evictable-idle-time-millis:1800000}"
|
||||
p:timeBetweenEvictionRunsMillis="${spring.redis.pool.time-between-eviction-runs-millis:-1}"
|
||||
p:jmxNameBase="${spring.redis.pool.jmx-name-base:#{null}}"
|
||||
p:jmxNamePrefix="${spring.redis.pool.jmx-name-prefix:pool}"
|
||||
/>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
@ -1,11 +1,14 @@
|
||||
package com.pudonghot.yo.redis.raw;
|
||||
|
||||
import org.junit.Test;
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.runner.RunWith;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.redisson.api.RBlockingQueue;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import com.pudonghot.yo.redis.RedisClientApi;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
@ -13,11 +16,13 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* Jun 19, 2017 16:53
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootTest(classes = TestDriver.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
||||
public class RawRedisClientTest {
|
||||
@Autowired
|
||||
private RedisClientApi redisClient;
|
||||
@Autowired
|
||||
private RedissonClient redisson;
|
||||
|
||||
@Test
|
||||
public void testRun() {
|
||||
@ -26,4 +31,17 @@ public class RawRedisClientTest {
|
||||
log.info("Get [{}] from redis result [{}].", key, redisClient.get(key));
|
||||
log.info("Delete [{}] from redis result [{}].", key, redisClient.del(key));
|
||||
}
|
||||
|
||||
@Test
|
||||
@SneakyThrows
|
||||
public void testQueue() {
|
||||
final RBlockingQueue<Object> queue = redisson.getBlockingQueue("anyQueue");
|
||||
queue.offer("1");
|
||||
queue.offer("2");
|
||||
queue.offer("3");
|
||||
log.info("Val1 [{}].", queue.poll());
|
||||
log.info("Val2 [{}].", queue.poll());
|
||||
log.info("Val3 [{}].", queue.poll());
|
||||
log.info("Val4 [{}].", queue.take());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.pudonghot.yo.redis.raw;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author Donghuang <br>
|
||||
* Jun 19, 2017 16:53
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
@ImportResource("classpath*:spring/spring-*.xml")
|
||||
public class TestDriver {
|
||||
|
||||
/**
|
||||
* main
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(TestDriver.class, args);
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
spring.application.name=yo-redis-raw
|
||||
|
||||
# Redis
|
||||
yo.redis.host=172.16.92.232
|
||||
yo.redis.port=6379
|
||||
yo.redis.password=123456
|
||||
spring.redis.host=172.16.92.232
|
||||
spring.redis.port=6379
|
||||
spring.redis.password=123456
|
||||
spring.redis.database=0
|
||||
|
||||
|
@ -1,5 +1,2 @@
|
||||
spring.application.name=Yo_MyBatis_Cache
|
||||
spring.application.name=yo-mybatis-cache
|
||||
|
||||
#redis cluster
|
||||
yo.redis-cluster.app-id=10003
|
||||
yo.redis-cluster.app-key=d7317ef13ea37c03f87fcd214755b341
|
||||
|
@ -16,9 +16,9 @@ yo.datasource.username=yoqw
|
||||
yo.datasource.password=yoqw_query!
|
||||
|
||||
# Redis
|
||||
yo.redis.host=172.16.92.232
|
||||
yo.redis.port=6379
|
||||
yo.redis.password=123456
|
||||
spring.redis.host=172.16.92.232
|
||||
spring.redis.port=6379
|
||||
spring.redis.password=123456
|
||||
|
||||
# Shiro
|
||||
tigon.shiro.filter-chain=/v1/auth/sign-in=anon \
|
||||
|
Loading…
x
Reference in New Issue
Block a user