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

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

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

Cache.isDisabled介绍

[英]Whether this cache is disabled. "Disabled" means:

  1. bootstrap is disabled
  2. puts are discarded
  3. putQuiets are discarded
  4. gets return null
    In all other respects the cache continues as it is.

You can disable and enable a cache programmatically through the #setDisabled(boolean) method.

By default caches are enabled on creation, unless the net.sf.ehcache.disabled system property is set.
[中]是否禁用此缓存。“残疾”是指:
1.已禁用引导
1.放弃看跌期权
1.丢弃无用的东西
1.返回null
在所有其他方面,缓存都会保持原样。
您可以通过#setDisabled(boolean)方法以编程方式禁用和启用缓存。
默认情况下,缓存在创建时启用,除非设置了net.sf.ehcache.disabled系统属性。

代码示例

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

/**
 * {@inheritDoc}
 */
public boolean isRegionCacheEnabled(String region) {
  Cache cache = this.cacheManager.getCache(region);
  if (cache != null) {
    return !cache.isDisabled();
  } else {
    return false;
  }
}

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

/**
 * {@inheritDoc}
 */
public boolean isRegionCachesEnabled() {
  for (String name : this.cacheManager.getCacheNames()) {
    Cache cache = this.cacheManager.getCache(name);
    if (cache != null) {
      if (cache.isDisabled()) {
        return false;
      }
    }
  }
  return true;
}

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

/**
 * Disables or enables this cache. This call overrides the previous value of disabled, even if the
 * <code>net.sf.ehcache.disabled</code> system property is set
 *
 * @param disabled true if you wish to disable, false to enable
 * @see #isDisabled()
 */
public void setDisabled(boolean disabled) {
  if (allowDisable) {
    boolean oldValue = isDisabled();
    if (oldValue != disabled) {
      synchronized (this) {
        this.disabled = disabled;
      }
      firePropertyChange("Disabled", oldValue, disabled);
    }
  } else {
    throw new CacheException("Dynamic cache features are disabled");
  }
}

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

/**
 * {@inheritDoc}
 */
public boolean isRegionCacheEnabled(String region) {
  Cache cache = this.cacheManager.getCache(region);
  if (cache != null) {
    return !cache.isDisabled();
  } else {
    return false;
  }
}

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

/**
 * {@inheritDoc}
 */
public boolean isRegionCacheEnabled(String region) {
  Cache cache = this.cacheManager.getCache(region);
  if (cache != null) {
    return !cache.isDisabled();
  } else {
    return false;
  }
}

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

/**
 * {@inheritDoc}
 */
public boolean isRegionCacheEnabled(String region) {
  Cache cache = this.cacheManager.getCache(region);
  if (cache != null) {
    return !cache.isDisabled();
  } else {
    return false;
  }
}

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

/**
 * {@inheritDoc}
 */
public boolean isRegionCachesEnabled() {
  for (String name : this.cacheManager.getCacheNames()) {
    Cache cache = this.cacheManager.getCache(name);
    if (cache != null) {
      if (cache.isDisabled()) {
        return false;
      }
    }
  }
  return true;
}

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

/**
 * {@inheritDoc}
 */
public boolean isRegionCachesEnabled() {
  for (String name : this.cacheManager.getCacheNames()) {
    Cache cache = this.cacheManager.getCache(name);
    if (cache != null) {
      if (cache.isDisabled()) {
        return false;
      }
    }
  }
  return true;
}

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

/**
 * {@inheritDoc}
 */
public boolean isRegionCachesEnabled() {
  for (String name : this.cacheManager.getCacheNames()) {
    Cache cache = this.cacheManager.getCache(name);
    if (cache != null) {
      if (cache.isDisabled()) {
        return false;
      }
    }
  }
  return true;
}

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

/**
 * Disables or enables this cache. This call overrides the previous value of disabled, even if the
 * <code>net.sf.ehcache.disabled</code> system property is set
 *
 * @param disabled true if you wish to disable, false to enable
 * @see #isDisabled()
 */
public void setDisabled(boolean disabled) {
  if (allowDisable) {
    boolean oldValue = isDisabled();
    if (oldValue != disabled) {
      synchronized (this) {
        this.disabled = disabled;
      }
      firePropertyChange("Disabled", oldValue, disabled);
    }
  } else {
    throw new CacheException("Dynamic cache features are disabled");
  }
}

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

/**
 * Disables or enables this cache. This call overrides the previous value of disabled, even if the
 * <code>net.sf.ehcache.disabled</code> system property is set
 * <p/>
 *
 * @param disabled true if you wish to disable, false to enable
 * @see #isDisabled()
 */
public void setDisabled(boolean disabled) {
  if (allowDisable) {
    boolean oldValue = isDisabled();
    if (oldValue != disabled) {
      synchronized (this) {
        this.disabled = disabled;
      }
      firePropertyChange("Disabled", oldValue, disabled);
    }
  } else {
    throw new CacheException("Dynamic cache features are disabled");
  }
}

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

/**
 * Disables or enables this cache. This call overrides the previous value of disabled, even if the
 * <code>net.sf.ehcache.disabled</code> system property is set
 * <p/>
 *
 * @param disabled true if you wish to disable, false to enable
 * @see #isDisabled()
 */
public void setDisabled(boolean disabled) {
  if (allowDisable) {
    boolean oldValue = isDisabled();
    if (oldValue != disabled) {
      synchronized (this) {
        this.disabled = disabled;
      }
      firePropertyChange("Disabled", oldValue, disabled);
    }
  } else {
    throw new CacheException("Dynamic cache features are disabled");
  }
}

相关文章

Cache类方法