net.oschina.j2cache.CacheChannel Java Examples

The following examples show how to use net.oschina.j2cache.CacheChannel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: J2cacheImpl.java    From jboot with Apache License 2.0 5 votes vote down vote up
private Method getSendClearCmdMethod() {
    try {
        Method method = CacheChannel.class.getDeclaredMethod("sendClearCmd", String.class);
        method.setAccessible(true);
        return method;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
Example #2
Source File: J2cacheImpl.java    From jboot with Apache License 2.0 5 votes vote down vote up
private Method getSendEvictCmdMethod() {
    try {
        Method method = CacheChannel.class.getDeclaredMethod("sendEvictCmd", String.class, String[].class);
        method.setAccessible(true);
        return method;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
Example #3
Source File: J2CacheSpringCacheAutoConfiguration.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
@Bean
@ConditionalOnBean(CacheChannel.class)
public J2CacheCacheManger cacheManager(CacheChannel cacheChannel) {
    Collection<String> cacheNames = cacheProperties.getCacheNames();
    J2CacheCacheManger cacheCacheManger = new J2CacheCacheManger(cacheChannel);
    cacheCacheManger.setAllowNullValues(j2CacheProperties.isAllowNullValues());
    cacheCacheManger.setCacheNames(cacheNames);
    return cacheCacheManger;
}
 
Example #4
Source File: J2cacheImpl.java    From jboot with Apache License 2.0 5 votes vote down vote up
@Override
public List getNames() {
    Collection<CacheChannel.Region> regions = J2Cache.getChannel().getL1Provider().regions();
    return regions != null && !regions.isEmpty()
            ? regions.stream().map(CacheChannel.Region::getName).collect(Collectors.toList())
            : null;
}
 
Example #5
Source File: J2CacheSpringCacheAutoConfiguration.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnBean(CacheChannel.class)
public J2CacheCacheManger cacheManager(CacheChannel cacheChannel) {
	List<String> cacheNames = cacheProperties.getCacheNames();
	J2CacheCacheManger cacheCacheManger = new J2CacheCacheManger(cacheChannel);
	cacheCacheManger.setAllowNullValues(j2CacheConfig.isAllowNullValues());
	cacheCacheManger.setCacheNames(cacheNames);
	return cacheCacheManger;
}
 
Example #6
Source File: J2Cache.java    From t-io with Apache License 2.0 5 votes vote down vote up
@Override
public Serializable _get(String key) {
	CacheChannel cache = getChannel();
	CacheObject cacheObject = cache.get(cacheName, key);
	if (cacheObject != null) {
		return (Serializable) cacheObject.getValue();
	}
	return null;
}
 
Example #7
Source File: J2CacheSpringCacheAutoConfiguration.java    From J2Cache with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnBean(CacheChannel.class)
public J2CacheCacheManger cacheManager(CacheChannel cacheChannel) {
	List<String> cacheNames = cacheProperties.getCacheNames();
	J2CacheCacheManger cacheCacheManger = new J2CacheCacheManger(cacheChannel);
	cacheCacheManger.setAllowNullValues(j2CacheConfig.isAllowNullValues());
	cacheCacheManger.setCacheNames(cacheNames);
	return cacheCacheManger;
}
 
Example #8
Source File: J2Cache.java    From t-io with Apache License 2.0 4 votes vote down vote up
@Override
public void clear() {
	CacheChannel cache = getChannel();
	cache.clear(cacheName);
}
 
Example #9
Source File: AbstractJ2CacheRegionFactory.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public void setChannel(CacheChannel channel) {
    this.channel = channel;
}
 
Example #10
Source File: J2HibernateCache.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public J2HibernateCache(String region, CacheChannel cache) {
    super();
    this.region = region;
    this.cache = cache;
}
 
Example #11
Source File: J2CacheRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public J2CacheRegion(String name, CacheChannel cache){
	this.regionName = name;
	this.cache = cache;
}
 
Example #12
Source File: J2CacheRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public Transactional(String name, CacheChannel cache) {
	super(name, cache);
}
 
Example #13
Source File: J2CacheRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public QueryResults(String name, CacheChannel cache) {
	super(name, cache);
}
 
Example #14
Source File: J2CacheRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public Entity(String name, CacheChannel cache) {
	super(name, cache);
}
 
Example #15
Source File: J2CacheRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public Collection(String name, CacheChannel cache) {
	super(name, cache);
}
 
Example #16
Source File: J2CacheRegion.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public Timestamps(String name, CacheChannel cache) {
	super(name, cache);
}
 
Example #17
Source File: LettuceCacheProvider.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Override
public Collection<CacheChannel.Region> regions() {
    return Collections.emptyList();
}
 
Example #18
Source File: J2Cache.java    From t-io with Apache License 2.0 4 votes vote down vote up
private static CacheChannel getChannel() {
	CacheChannel cache = net.oschina.j2cache.J2Cache.getChannel();
	return cache;
}
 
Example #19
Source File: AbstractJ2CacheRegionFactory.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public void setChannel(CacheChannel channel) {
    this.channel = channel;
}
 
Example #20
Source File: J2Cache.java    From t-io with Apache License 2.0 4 votes vote down vote up
@Override
public Collection<String> keys() {
	CacheChannel cache = getChannel();
	return cache.keys(cacheName);
}
 
Example #21
Source File: J2Cache.java    From t-io with Apache License 2.0 4 votes vote down vote up
@Override
public void put(String key, Serializable value) {
	CacheChannel cache = getChannel();
	cache.set(cacheName, key, value);
}
 
Example #22
Source File: J2Cache.java    From t-io with Apache License 2.0 4 votes vote down vote up
@Override
public void remove(String key) {
	CacheChannel cache = getChannel();
	cache.evict(cacheName, key);
}
 
Example #23
Source File: J2Cache.java    From weed3 with Apache License 2.0 4 votes vote down vote up
public J2Cache(String keyHeader, int defSeconds,  CacheChannel cacheChannel) {
    _cacheKeyHead = keyHeader;
    _defaultSeconds = defSeconds;

    _cache = cacheChannel;
}
 
Example #24
Source File: J2CacheCache.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 4 votes vote down vote up
public J2CacheCache(String cacheName, CacheChannel cacheChannel) {
    this(cacheName, cacheChannel, true);
}
 
Example #25
Source File: J2CacheCache.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 4 votes vote down vote up
public J2CacheCache(String cacheName, CacheChannel cacheChannel, boolean allowNullValues) {
    super(allowNullValues);
    j2CacheName = cacheName;
    this.cacheChannel = cacheChannel;
}
 
Example #26
Source File: J2CacheCacheManger.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 4 votes vote down vote up
public J2CacheCacheManger(CacheChannel cacheChannel) {
    this.cacheChannel = cacheChannel;
}
 
Example #27
Source File: J2CacheAutoConfiguration.java    From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International 4 votes vote down vote up
@Bean
@DependsOn({ "springUtil", "j2CacheConfig" })
public CacheChannel cacheChannel(J2CacheConfig j2CacheConfig) {
    J2CacheBuilder builder = J2CacheBuilder.init(j2CacheConfig);
    return builder.getChannel();
}
 
Example #28
Source File: Aooms.java    From Aooms with Apache License 2.0 4 votes vote down vote up
public CacheChannel getJ2Cache() {
    return j2Cache;
}
 
Example #29
Source File: J2CacheAutoConfiguration.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
@Bean
@DependsOn({"springUtil","j2CacheConfig"})
public CacheChannel cacheChannel(net.oschina.j2cache.J2CacheConfig j2CacheConfig) throws IOException {
	J2CacheBuilder builder = J2CacheBuilder.init(j2CacheConfig);
    return builder.getChannel();
}
 
Example #30
Source File: J2CacheCache.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public J2CacheCache(String cacheName, CacheChannel cacheChannel) {
	this(cacheName,cacheChannel, true);
}