-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename SpringDataRedis to RedisSpringData
- Loading branch information
Showing
6 changed files
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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() { | ||
|
@@ -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; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
|
@@ -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; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
|
@@ -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) | ||
|
@@ -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) | ||
|
@@ -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) | ||
|