net.sf.ehcache.Cache.getName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(182)

本文整理了Java中net.sf.ehcache.Cache.getName()方法的一些代码示例,展示了Cache.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.getName()方法的具体详情如下:
包路径:net.sf.ehcache.Cache
类名称:Cache
方法名:getName

Cache.getName介绍

[英]Gets the cache name.
[中]获取缓存名称。

代码示例

代码示例来源:origin: net.sf.ehcache/ehcache

private void handleExceptionInTerracottaStoreCreation(IllegalArgumentException e) {
  if (e.getMessage().contains("copyOnReadEnabled")) {
    throw new InvalidConfigurationException("Conflict in configuration for clustered cache " + getName() + " . " +
                        "Source is either copyOnRead or transactional mode setting.");
  } else {
    throw new InvalidConfigurationException("Conflict in configuration for clustered cache " + getName() + " : " + e.getMessage());
  }
}

代码示例来源:origin: spring-projects/spring-framework

assertSame(objectType, objectType2);
CacheConfiguration config = cache.getCacheConfiguration();
assertEquals("myCache1", cache.getName());
if (useCacheManagerFb){
  assertEquals("myCache1.maxElements", 300, config.getMaxEntriesLocalHeap());
cache = (Cache) cacheFb.getObject();
config = cache.getCacheConfiguration();
assertEquals("undefinedCache", cache.getName());
assertTrue("default maxElements is correct", config.getMaxEntriesLocalHeap() == 10000);
assertFalse("default eternal is correct", config.isEternal());
config = cache.getCacheConfiguration();
assertEquals("undefinedCache2", cache.getName());
assertTrue("overridden maxElements is correct", config.getMaxEntriesLocalHeap() == 5);
assertTrue("default timeToLive is correct", config.getTimeToLiveSeconds() == 8);

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * {@inheritDoc}
 */
public <T> Attribute<T> getSearchAttribute(String attributeName) throws CacheException {
  // We don't trust config here since the store is the real authority
  checkStatus();
  Attribute<T> searchAttribute = compoundStore.getSearchAttribute(attributeName);
  if (searchAttribute == null) {
    final String msg;
    if (attributeName.equals(Query.KEY.getAttributeName())) {
      msg = "Key search attribute is disabled for cache [" + getName() + "]. It can be enabled with <searchable keys=\"true\"...";
    } else if (attributeName.equals(Query.VALUE.getAttributeName())) {
      msg = "Value search attribute is disabled for cache [" + getName() + "]. It can be enabled with <searchable values=\"true\"...";
    } else {
      msg = "No such search attribute [" + attributeName + "] defined for this cache [" + getName() + "]";
    }
    throw new CacheException(msg);
  }
  return searchAttribute;
}

代码示例来源:origin: net.sf.ehcache/ehcache

if (cache.getName().equals(parentCacheName)) {
isUpdate = cache.getName().equals(getName()) || isUpdate;
final CacheConfiguration config = cache.getCacheConfiguration();
totalOnHeapAssignedMemory += config.getMaxBytesLocalHeap();

代码示例来源:origin: net.sf.ehcache/ehcache

prop += "." + cache.getName();
} catch (Exception exception) {
  throw new RuntimeException("Couldn't load and instantiate custom "
      + (cache != null ? "SizeOfEngine for cache '" + cache.getName() + "'" : "default SizeOfEngine"), exception);

代码示例来源:origin: net.sf.ehcache/ehcache

&& !clusteredTransactionalMode.equals(getCacheConfiguration().getTransactionalMode())) {
throw new InvalidConfigurationException("Transactional mode cannot be changed on clustered caches. "
    + "Please reconfigure cache '" + getName() + "' with transactionalMode = " + clusteredTransactionalMode);

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * {@inheritDoc}
 */
public void init(Cache cache) throws CacheException {
  CacheWriter cacheWriter = cache.getRegisteredCacheWriter();
  if (null == cacheWriter) {
    throw new CacheException("No cache writer was registered for cache " + cache.getName());
  }
  if (cache.getCacheConfiguration().getCacheWriterConfiguration().getWriteCoalescing()) {
    writeBehind.setOperationsFilter(new CoalesceKeysFilter());
  }
  writeBehind.start(cacheWriter);
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public String getRegionName() {
  return cache.getName();
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

private void handleExceptionInTerracottaStoreCreation(IllegalArgumentException e) {
  if (e.getMessage().contains("copyOnReadEnabled")) {
    throw new InvalidConfigurationException("Conflict in configuration for clustered cache " + getName() + " . " +
                        "Source is either copyOnRead or transactional mode setting.");
  } else {
    throw new InvalidConfigurationException("Conflict in configuration for clustered cache " + getName() + " : " + e.getMessage());
  }
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

private void handleExceptionInTerracottaStoreCreation(IllegalArgumentException e) {
  if (e.getMessage().contains("copyOnReadEnabled")) {
    throw new InvalidConfigurationException("Conflict in configuration for clustered cache " + getName() + " . " +
                        "Source is either copyOnRead or transactional mode setting.");
  } else {
    throw new InvalidConfigurationException("Conflict in configuration for clustered cache " + getName() + " : " + e.getMessage());
  }
}

代码示例来源:origin: org.jasig.cas.client/cas-client-support-distributed-ehcache

public EhcacheBackedProxyGrantingTicketStorageImpl() {
  this(CacheManager.getInstance().getCache(EHCACHE_CACHE_NAME));
  logger.info("Created cache with name: {}", this.cache.getName());
}

代码示例来源:origin: apereo/java-cas-client

public EhcacheBackedProxyGrantingTicketStorageImpl() {
  this(CacheManager.getInstance().getCache(EHCACHE_CACHE_NAME));
  logger.info("Created cache with name: {}", this.cache.getName());
}

代码示例来源:origin: net.sf.ehcache/ehcache

getCacheManager().getClusteredInstanceFactory().unlinkCache(getName());

代码示例来源:origin: uk.ac.ebi.enfin.mi.cluster/micluster

private void shutdownIfActive( Cache cache ) {
     if( Status.STATUS_ALIVE.equals( cache.getStatus() ) ) {
       System.out.println( "Attempting to dispose of: " + cache.getName() + "..." );
       cache.dispose();
     } else {
       System.out.println( "Cache('"+ cache.getName() +"') was not alive. Skipping dispose()..." );
     }
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * {@inheritDoc}
 */
public Results executeQuery(StoreQuery query) {
  if (searchManager == null) {
    throw new UnsupportedOperationException("Query execution not supported by this store type: " + getClass().getName());
  }
  return searchManager.executeQuery(query.getCache().getName(), query, attributeExtractors);
}

代码示例来源:origin: net.sf.ehcache/ehcache

if (!getName().startsWith(CacheManager.LOCAL_CACHE_NAME_PREFIX)) {                              
  throw new CacheException("This cache (" + getName() + ") is configurated with a different classloader reference than its containing cache manager");                               
if (getCacheConfiguration().getTerracottaConfiguration().getConcurrency() > maxConcurrency) {
  throw new InvalidConfigurationException("Maximum supported concurrency for Terracotta clustered caches is "
      + maxConcurrency + ". Please reconfigure cache '" + getName() + "' with concurrency value <= " + maxConcurrency
      + " or use system property '" + EHCACHE_CLUSTERREDSTORE_MAX_CONCURRENCY_PROP + "' to override the default");

代码示例来源:origin: com.github.tianjing/tgtools.core

/**
 * 根据名称创建缓存区
 * 
 * @param p_Cache
 */
public static void create(Cache p_Cache) {
  if (!m_Manager.cacheExists(p_Cache.getName())) {
    m_Manager.addCache(p_Cache);
  }
}
public static void create(String p_CacheName) {

代码示例来源:origin: caojx-git/learn

@Cacheable(value = "myCache", key = "'get'+#id")
public UserInfo getUserById(int id) {
  Cache cache = ehCacheService.getCache("myCache");
  System.out.println("进来了查询方法......cache.getKeys()="+cache.getName());
  UserInfo u = new UserInfo();
  u.setName("土豆大人");
  return u;
}

代码示例来源:origin: org.ujmp/ujmp-ehcache

public void close() throws IOException {
    getCacheManager().removeCache(getCache().getName());
  }
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
 * {@inheritDoc}
 */
public void init(Cache cache) throws CacheException {
  CacheWriter cacheWriter = cache.getRegisteredCacheWriter();
  if (null == cacheWriter) {
    throw new CacheException("No cache writer was registered for cache " + cache.getName());
  }
  if (cache.getCacheConfiguration().getCacheWriterConfiguration().getWriteCoalescing()) {
    writeBehind.setOperationsFilter(new CoalesceKeysFilter());
  }
  writeBehind.start(cacheWriter);
}

相关文章

微信公众号

最新文章

更多

Cache类方法