Skip to content

Commit

Permalink
rename SpringDataRedis to RedisSpringData
Browse files Browse the repository at this point in the history
  • Loading branch information
areyouok committed May 1, 2019
1 parent e655411 commit 69f1332
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
CaffeineAutoConfiguration.class,
LinkedHashMapAutoConfiguration.class,
RedisLettuceAutoConfiguration.class,
SpringDataRedisAutoConfiguration.class})
RedisSpringDataAutoConfiguration.class})
public class JetCacheAutoConfiguration {

public static final String GLOBAL_CACHE_CONFIG_NAME = "globalCacheConfig";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.alicp.jetcache.CacheBuilder;
import com.alicp.jetcache.CacheConfigException;
import com.alicp.jetcache.external.ExternalCacheBuilder;
import com.alicp.jetcache.redis.springdata.SpringDataRedisCacheBuilder;
import com.alicp.jetcache.redis.springdata.RedisSpringDataCacheBuilder;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
Expand All @@ -20,8 +20,8 @@
* @author <a href="mailto:[email protected]">huangli</a>
*/
@Configuration
@Conditional(SpringDataRedisAutoConfiguration.SpringDataRedisCondition.class)
public class SpringDataRedisAutoConfiguration {
@Conditional(RedisSpringDataAutoConfiguration.SpringDataRedisCondition.class)
public class RedisSpringDataAutoConfiguration {

public static class SpringDataRedisCondition extends JetCacheCondition {
public SpringDataRedisCondition() {
Expand Down Expand Up @@ -61,7 +61,7 @@ protected CacheBuilder initCache(ConfigTree ct, String cacheAreaWithPrefix) {
}
factory = beans.get(connectionFactoryName);
}
ExternalCacheBuilder builder = SpringDataRedisCacheBuilder.createBuilder().connectionFactory(factory);
ExternalCacheBuilder builder = RedisSpringDataCacheBuilder.createBuilder().connectionFactory(factory);
parseGeneralConfig(builder, ct);
return builder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
*
* @author <a href="mailto:[email protected]">huangli</a>
*/
public class SpringDataRedisCache<K, V> extends AbstractExternalCache<K, V> {
public class RedisSpringDataCache<K, V> extends AbstractExternalCache<K, V> {

private Logger logger = LoggerFactory.getLogger(SpringDataRedisCache.class);
private Logger logger = LoggerFactory.getLogger(RedisSpringDataCache.class);

private RedisConnectionFactory connectionFactory;
private SpringDataRedisCacheConfig<K, V> config;
private RedisSpringDataCacheConfig<K, V> config;

private Function<Object, byte[]> valueEncoder;
private Function<byte[], Object> valueDecoder;

public SpringDataRedisCache(SpringDataRedisCacheConfig<K, V> config) {
public RedisSpringDataCache(RedisSpringDataCacheConfig<K, V> config) {
super(config);
this.connectionFactory = config.getConnectionFactory();
if (connectionFactory == null) {
Expand Down Expand Up @@ -227,11 +227,11 @@ protected CacheResult do_PUT_IF_ABSENT(K key, V value, long expireAfterWrite, Ti

@Override
public <T> T unwrap(Class<T> clazz) {
throw new UnsupportedOperationException("SpringDataRedisCache does not support unwrap");
throw new UnsupportedOperationException("RedisSpringDataCache does not support unwrap");
}

@Override
public SpringDataRedisCacheConfig<K, V> config() {
public RedisSpringDataCacheConfig<K, V> config() {
return config;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
*
* @author <a href="mailto:[email protected]">huangli</a>
*/
public class SpringDataRedisCacheBuilder<T extends ExternalCacheBuilder<T>> extends ExternalCacheBuilder<T> {
public static class SpringDataRedisCacheBuilderImpl extends SpringDataRedisCacheBuilder<SpringDataRedisCacheBuilderImpl> {
public class RedisSpringDataCacheBuilder<T extends ExternalCacheBuilder<T>> extends ExternalCacheBuilder<T> {
public static class RedisSpringDataCacheBuilderImpl extends RedisSpringDataCacheBuilder<RedisSpringDataCacheBuilderImpl> {
}

public static SpringDataRedisCacheBuilderImpl createBuilder() {
return new SpringDataRedisCacheBuilderImpl();
public static RedisSpringDataCacheBuilderImpl createBuilder() {
return new RedisSpringDataCacheBuilderImpl();
}

protected SpringDataRedisCacheBuilder() {
buildFunc(config -> new SpringDataRedisCache((SpringDataRedisCacheConfig) config));
protected RedisSpringDataCacheBuilder() {
buildFunc(config -> new RedisSpringDataCache((RedisSpringDataCacheConfig) config));
}

@Override
public SpringDataRedisCacheConfig getConfig() {
public RedisSpringDataCacheConfig getConfig() {
if (config == null) {
config = new SpringDataRedisCacheConfig();
config = new RedisSpringDataCacheConfig();
}
return (SpringDataRedisCacheConfig) config;
return (RedisSpringDataCacheConfig) config;
}

public T connectionFactory(RedisConnectionFactory connectionFactory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*
* @author <a href="mailto:[email protected]">huangli</a>
*/
public class SpringDataRedisCacheConfig<K, V> extends ExternalCacheConfig<K, V> {
public class RedisSpringDataCacheConfig<K, V> extends ExternalCacheConfig<K, V> {

private RedisConnectionFactory connectionFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @author <a href="mailto:[email protected]">huangli</a>
*/
public class SpringDataRedisCacheTest extends AbstractExternalCacheTest {
public class RedisSpringDataCacheTest extends AbstractExternalCacheTest {

@Test
public void jedisTest() throws Exception {
Expand All @@ -38,7 +38,7 @@ public void lettuceTest() throws Exception {
private void doTest(RedisConnectionFactory connectionFactory) throws Exception {


cache = SpringDataRedisCacheBuilder.createBuilder()
cache = RedisSpringDataCacheBuilder.createBuilder()
.keyConvertor(FastjsonKeyConvertor.INSTANCE)
.valueEncoder(JavaValueEncoder.INSTANCE)
.valueDecoder(JavaValueDecoder.INSTANCE)
Expand All @@ -51,21 +51,21 @@ private void doTest(RedisConnectionFactory connectionFactory) throws Exception {
fastjsonKeyCoverterTest();
expireAfterWriteTest(cache.config().getExpireAfterWriteInMillis());

LoadingCacheTest.loadingCacheTest(SpringDataRedisCacheBuilder.createBuilder()
LoadingCacheTest.loadingCacheTest(RedisSpringDataCacheBuilder.createBuilder()
.keyConvertor(FastjsonKeyConvertor.INSTANCE)
.valueEncoder(JavaValueEncoder.INSTANCE)
.valueDecoder(JavaValueDecoder.INSTANCE)
.connectionFactory(connectionFactory)
.keyPrefix(new Random().nextInt() + ""), 0);
RefreshCacheTest.refreshCacheTest(SpringDataRedisCacheBuilder.createBuilder()
RefreshCacheTest.refreshCacheTest(RedisSpringDataCacheBuilder.createBuilder()
.keyConvertor(FastjsonKeyConvertor.INSTANCE)
.valueEncoder(JavaValueEncoder.INSTANCE)
.valueDecoder(JavaValueDecoder.INSTANCE)
.connectionFactory(connectionFactory)
.keyPrefix(new Random().nextInt() + ""), 200, 100);


cache = SpringDataRedisCacheBuilder.createBuilder()
cache = RedisSpringDataCacheBuilder.createBuilder()
.keyConvertor(null)
.valueEncoder(KryoValueEncoder.INSTANCE)
.valueDecoder(KryoValueDecoder.INSTANCE)
Expand All @@ -76,7 +76,7 @@ private void doTest(RedisConnectionFactory connectionFactory) throws Exception {

int thread = 10;
int time = 3000;
cache = SpringDataRedisCacheBuilder.createBuilder()
cache = RedisSpringDataCacheBuilder.createBuilder()
.keyConvertor(FastjsonKeyConvertor.INSTANCE)
.valueEncoder(KryoValueEncoder.INSTANCE)
.valueDecoder(KryoValueDecoder.INSTANCE)
Expand Down

0 comments on commit 69f1332

Please sign in to comment.