当前位置: 首页>>代码示例>>Java>>正文


Java Configuration.isStoreByValue方法代码示例

本文整理汇总了Java中javax.cache.configuration.Configuration.isStoreByValue方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.isStoreByValue方法的具体用法?Java Configuration.isStoreByValue怎么用?Java Configuration.isStoreByValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.cache.configuration.Configuration的用法示例。


在下文中一共展示了Configuration.isStoreByValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isStoreByValue

import javax.cache.configuration.Configuration; //导入方法依赖的package包/类
private static <K, V> boolean isStoreByValue(Configuration<K, V> config, CacheConfiguration<K, V> ehcacheConfig) {
  if(ehcacheConfig != null) {
    Collection<ServiceConfiguration<?>> serviceConfigurations = ehcacheConfig.getServiceConfigurations();
    for (ServiceConfiguration<?> serviceConfiguration : serviceConfigurations) {
      if (serviceConfiguration instanceof DefaultCopierConfiguration) {
        DefaultCopierConfiguration<?> copierConfig = (DefaultCopierConfiguration)serviceConfiguration;
        if(copierConfig.getType().equals(DefaultCopierConfiguration.Type.VALUE)) {
          if(copierConfig.getClazz().isAssignableFrom(IdentityCopier.class)) {
            return false;
          } else {
            return true;
          }
        }
      }
    }
  }
  return config.isStoreByValue();
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:19,代码来源:Eh107CompleteConfiguration.java

示例2: BlazingCacheCache

import javax.cache.configuration.Configuration; //导入方法依赖的package包/类
public BlazingCacheCache(String cacheName, CacheClient client, CacheManager cacheManager, Serializer<K, String> keysSerializer, Serializer<V, byte[]> valuesSerializer, boolean usefetch, Configuration<K, V> configuration) {
    this.cacheName = cacheName;
    this.cacheManager = cacheManager;
    this.client = client;
    this.keysSerializer = keysSerializer;
    this.valuesSerializer = valuesSerializer;
    this.valueType = configuration.getValueType();
    this.keyType = configuration.getKeyType();
    this.usefetch = usefetch;
    this.configurationMXBean = new BlazingCacheConfigurationMXBean<>(this);
    this.statisticsMXBean = new BlazingCacheStatisticsMXBean<>(this);
    this.storeByReference = !configuration.isStoreByValue();
    if (configuration instanceof CompleteConfiguration) {
        this.configuration = new MutableConfiguration<>((CompleteConfiguration<K, V>) configuration);
        CompleteConfiguration<K, V> cc = (CompleteConfiguration<K, V>) configuration;
        if (cc.getExpiryPolicyFactory() == null) {
            throw new IllegalArgumentException("ExpiryPolicyFactory cannot be null");
        } else {
            ExpiryPolicy _policy = cc.getExpiryPolicyFactory().create();;
            if (_policy == null) {
                throw new IllegalArgumentException("ExpiryPolicy cannot be null");
            }
            if (_policy instanceof EternalExpiryPolicy) {
                this.policy = null; // shortcut for the most common case
            } else {
                this.policy = _policy;
            }
        }

        if (cc.getCacheLoaderFactory() != null) {
            cacheLoader = (CacheLoader) cc.getCacheLoaderFactory().create();
        } else {
            cacheLoader = null;
        }
        if (cc.getCacheWriterFactory() != null) {
            cacheWriter = (CacheWriter<K, V>) cc.getCacheWriterFactory().create();
        } else {
            cacheWriter = null;
        }
        isReadThrough = cc.isReadThrough();
        isWriteThrough = cc.isWriteThrough();
        needPreviuosValueForListeners = policy != null;
        if (cc.getCacheEntryListenerConfigurations() != null) {
            for (CacheEntryListenerConfiguration<K, V> listenerConfig : cc.getCacheEntryListenerConfigurations()) {
                configureListener(listenerConfig);
            }
        }
    } else {
        this.configuration = new MutableConfiguration<K, V>()
            .setTypes(configuration.getKeyType(), configuration.getValueType())
            .setStoreByValue(configuration.isStoreByValue());
        this.policy = null; // means "eternal"
        cacheLoader = null;
        needPreviuosValueForListeners = false;
        cacheWriter = null;
        isReadThrough = false;
        isWriteThrough = false;
    }
    if (isReadThrough && cacheLoader == null) {
        throw new IllegalArgumentException("cache isReadThrough=" + isReadThrough + " cacheLoader=" + cacheLoader);
    }
    if (isWriteThrough && cacheWriter == null) {
        throw new IllegalArgumentException("cache isWriteThrough=" + isWriteThrough + " cacheWriter=" + cacheWriter);
    }
    if (this.configuration.isManagementEnabled()) {
        setManagementEnabled(true);
    }

    if (this.configuration.isStatisticsEnabled()) {
        setStatisticsEnabled(true);
    }

}
 
开发者ID:diennea,项目名称:blazingcache,代码行数:74,代码来源:BlazingCacheCache.java


注:本文中的javax.cache.configuration.Configuration.isStoreByValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。