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


Java CacheWriter类代码示例

本文整理汇总了Java中javax.cache.integration.CacheWriter的典型用法代码示例。如果您正苦于以下问题:Java CacheWriter类的具体用法?Java CacheWriter怎么用?Java CacheWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: JCache

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
public JCache(JCacheManager cacheManager, Redisson redisson, String name, JCacheConfiguration<K, V> config, boolean hasOwnRedisson) {
    super(redisson.getConfig().getCodec(), redisson.getCommandExecutor(), name);
    
    this.hasOwnRedisson = hasOwnRedisson;
    this.redisson = redisson;
    
    Factory<CacheLoader<K, V>> cacheLoaderFactory = config.getCacheLoaderFactory();
    if (cacheLoaderFactory != null) {
        cacheLoader = cacheLoaderFactory.create();
    }
    Factory<CacheWriter<? super K, ? super V>> cacheWriterFactory = config.getCacheWriterFactory();
    if (config.getCacheWriterFactory() != null) {
        cacheWriter = (CacheWriter<K, V>) cacheWriterFactory.create();
    }
    
    this.cacheManager = cacheManager;
    this.config = config;
    
    redisson.getEvictionScheduler().scheduleJCache(getName(), getTimeoutSetName(), getExpiredChannelName());
    
    for (CacheEntryListenerConfiguration<K, V> listenerConfig : config.getCacheEntryListenerConfigurations()) {
        registerCacheEntryListener(listenerConfig, false);
    }
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:25,代码来源:JCache.java

示例2: WriteThruProviderMgr

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
public WriteThruProviderMgr(String cacheName, CacheWriter writer, CacheRuntimeContext context, int timeout, long operationDelay, String providerName) throws ConfigurationException {
    _context = context;
    _cacheName = cacheName;
    _operationDelay = operationDelay;
    _myProvider = providerName;
    _dsWriter = new JCacheWriteThruProvider((CacheWriter<Object,Object>)writer);
}
 
开发者ID:Alachisoft,项目名称:TayzGrid,代码行数:8,代码来源:WriteThruProviderMgr.java

示例3: ActionRunner

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
ActionRunner(ActionContext<K,V> actionContext)
{
	// actionContext. It is currently taken directly from the Cache
        CacheWriter<K, V> writer = actionContext.cacheWriter();
        if (writer instanceof NopCacheWriter)
        {
            this.cacheWriter = null;
        }
        else
        {               
            this.cacheWriter = actionContext.cacheWriter();
        }
	this.listeners = actionContext.listeners();
	this.stats = actionContext.statisticsCalculator();		
}
 
开发者ID:trivago,项目名称:triava,代码行数:16,代码来源:ActionRunner.java

示例4: CacheWriterWrapper

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
public CacheWriterWrapper(CacheWriter<? super K, ? super V> cw, boolean isAsync)
	{
		@SuppressWarnings("unchecked")
		CacheWriter<K, V> cw2 = (CacheWriter<K, V>) cw;
		this.cacheWriter = cw2;
//		this.isAsync = isAsync;
	}
 
开发者ID:trivago,项目名称:triava,代码行数:8,代码来源:CacheWriterWrapper.java

示例5: GridCacheLoaderWriterStore

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
/**
 * @param ldr Loader.
 * @param writer Writer.
 */
GridCacheLoaderWriterStore(@Nullable CacheLoader<K, V> ldr, @Nullable CacheWriter<K, V> writer) {
    assert ldr != null || writer != null;

    this.ldr = ldr;
    this.writer = writer;
}
 
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:GridCacheLoaderWriterStore.java

示例6: GridCacheLoaderWriterStoreFactory

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
/**
 * @param ldrFactory Loader factory.
 * @param writerFactory Writer factory.
 */
GridCacheLoaderWriterStoreFactory(@Nullable Factory<CacheLoader<K, V>> ldrFactory,
    @Nullable Factory<CacheWriter<K, V>> writerFactory) {
    this.ldrFactory = ldrFactory;
    this.writerFactory = writerFactory;

    assert ldrFactory != null || writerFactory != null;
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:GridCacheLoaderWriterStoreFactory.java

示例7: create

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public CacheStore<K, V> create() {
    CacheLoader<K, V> ldr = ldrFactory == null ? null : ldrFactory.create();

    CacheWriter<K, V> writer = writerFactory == null ? null : writerFactory.create();

    return new GridCacheLoaderWriterStore<>(ldr, writer);
}
 
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridCacheLoaderWriterStoreFactory.java

示例8: setCacheWriterFactory

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public CacheConfiguration<K, V> setCacheWriterFactory(
    Factory<? extends CacheWriter<? super K, ? super V>> factory) {
    super.setCacheWriterFactory(factory);

    return this;
}
 
开发者ID:apache,项目名称:ignite,代码行数:8,代码来源:CacheConfiguration.java

示例9: Eh107CacheLoaderWriter

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
Eh107CacheLoaderWriter(CacheLoader<K, V> cacheLoader, boolean readThrough, CacheWriter<K, V> cacheWriter, boolean writeThrough) {
  this.cacheLoader = cacheLoader;
  this.readThrough = cacheLoader != null && readThrough;
  if (writeThrough) {
    this.cacheWriter = cacheWriter;
  } else {
    this.cacheWriter = null;
  }
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:10,代码来源:Eh107CacheLoaderWriter.java

示例10: initCacheLoaderWriter

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
private <K, V> Jsr107CacheLoaderWriter<K, V> initCacheLoaderWriter(CompleteConfiguration<K, V> config, MultiCacheException mce) {
  Factory<CacheLoader<K, V>> cacheLoaderFactory = config.getCacheLoaderFactory();
  @SuppressWarnings("unchecked")
  Factory<CacheWriter<K, V>> cacheWriterFactory = (Factory<CacheWriter<K, V>>) (Object) config.getCacheWriterFactory();

  if (config.isReadThrough() && cacheLoaderFactory == null) {
    throw new IllegalArgumentException("read-through enabled without a CacheLoader factory provided");
  }
  if (config.isWriteThrough() && cacheWriterFactory == null) {
    throw new IllegalArgumentException("write-through enabled without a CacheWriter factory provided");
  }

  CacheLoader<K, V> cacheLoader = cacheLoaderFactory == null ? null : cacheLoaderFactory.create();
  CacheWriter<K, V> cacheWriter;
  try {
    cacheWriter = cacheWriterFactory == null ? null : cacheWriterFactory.create();
  } catch (Throwable t) {
    if (t != mce) {
      mce.addThrowable(t);
    }
    CacheResources.close(cacheLoader, mce);
    throw mce;
  }

  if (cacheLoader == null && cacheWriter == null) {
    return null;
  } else {
    return new Eh107CacheLoaderWriter<>(cacheLoader, config.isReadThrough(), cacheWriter, config.isWriteThrough());
  }
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:31,代码来源:ConfigurationMerger.java

示例11: jsr107WriterGetsRegistered

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
@Test
public void jsr107WriterGetsRegistered() {
  MutableConfiguration<Object, Object> configuration = new MutableConfiguration<>();
  CacheWriter<Object, Object> mock = mock(CacheWriter.class);
  RecordingFactory<CacheWriter<Object, Object>> factory = factoryOf(mock);
  configuration.setWriteThrough(true).setCacheWriterFactory(factory);

  merger.mergeConfigurations("cache", configuration);

  assertThat(factory.called, is(true));
  verify(cacheLoaderWriterFactory).registerJsr107Loader(eq("cache"), ArgumentMatchers.<CacheLoaderWriter<Object, Object>>isNotNull());
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:13,代码来源:ConfigurationMergerTest.java

示例12: getConfiguration

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
private MutableConfiguration<Long, String> getConfiguration(final boolean readThrough, final CacheLoader<Long, String> cacheLoader,
                                                            final boolean writeThrough, final CacheWriter<Long, String> cacheWriter) {
  MutableConfiguration<Long, String> config = new MutableConfiguration<>();
  config.setTypes(Long.class, String.class);
  config.setReadThrough(readThrough);
  config.setCacheLoaderFactory(() -> cacheLoader);
  config.setWriteThrough(writeThrough);
  config.setCacheWriterFactory(() -> cacheWriter);
  return config;
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:11,代码来源:LoaderWriterConfigTest.java

示例13: CacheWriterServer

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
/**
 * Constructs an CacheWriterServer.
 *
 * @param port        the port on which to accept {@link CacheWriterClient} requests
 * @param cacheWriter (optional) the {@link CacheWriter} that will be used to handle
 *                    client requests
 */
public CacheWriterServer(int port, CacheWriter<K, V> cacheWriter) {
    super(port);

    // establish the client-server operation handlers
    addOperationHandler(new WriteOperationHandler());
    addOperationHandler(new WriteAllOperationHandler());
    addOperationHandler(new DeleteOperationHandler());
    addOperationHandler(new DeleteAllOperationHandler());

    this.cacheWriter = cacheWriter;
}
 
开发者ID:cache2k,项目名称:cache2k,代码行数:19,代码来源:CacheWriterServer.java

示例14: getCacheWriterFactory

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
@Override
public Factory<CacheWriter<? super K, ? super V>> getCacheWriterFactory() {
    return delegate.getCacheWriterFactory();
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:5,代码来源:JCacheConfiguration.java

示例15: getCacheWriterFactory

import javax.cache.integration.CacheWriter; //导入依赖的package包/类
/**
 * The {@link CacheWriter} factory
 */
public Factory<CacheWriter> getCacheWriterFactory() {
    return cacheWriterFactory;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:JCacheConfiguration.java


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