Package net.sf.ehcache

Examples of net.sf.ehcache.CacheManager


    private net.sf.ehcache.Cache cache;

    public EHCacheCache(String name) throws Exception
    {

        CacheManager cacheManager = CacheManager.getInstance();

        cache = cacheManager.getCache(name);

        if (cache == null)
        {
            cacheManager.addCache(name);

            cache = cacheManager.getCache(name);
        }
    }
View Full Code Here


    {
      manager = CacheManager.getInstance();
    }
    else
    {
      manager = new CacheManager();
    }

    cacheManager = new GlobalCacheManager();
    if (manager.cacheExists(CACHE_NAME) == false)
    {
View Full Code Here

        super(name);
    }

    public void setUp() throws Exception
    {
        _cacheManager = new CacheManager();

        super.setUp();
    }
View Full Code Here

            String configurationResourceName = null;
            if (properties != null) {
                configurationResourceName = (String) properties.get( Environment.CACHE_PROVIDER_CONFIG );
            }
            if ( StringHelper.isEmpty( configurationResourceName ) ) {
                manager = new CacheManager();
            } else {
                URL url = loadResource(configurationResourceName);
                manager = new CacheManager(url);
            }

            // Register statistics MBean of EHCache on the current MBean server
            log.info("registering EHCache monitoring MBean");
            MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
View Full Code Here

    @Create
    public void startup() throws Exception {

        log.info("starting wiki page fragment cache regions");
        try {
            CacheManager manager = EHCacheManager.instance();

            Set<String> requiredCacheRegions = new HashSet<String>();

            if (cacheRegions != null) {
                requiredCacheRegions.addAll(cacheRegions);
            }

            PluginRegistry pluginRegistry = PluginRegistry.instance();
            for (Plugin plugin : pluginRegistry.getPlugins()) {
                for (PluginModule pluginModule : plugin.getModules()) {
                    if (pluginModule.getFragmentCacheRegions() != null)
                        requiredCacheRegions.addAll(pluginModule.getFragmentCacheRegions());
                }
            }

            for (String cacheRegion : requiredCacheRegions) {
                Cache cache = EHCacheManager.instance().getCache(cacheRegion);
                if (cache == null) {
                    log.info("using default configuration for region '" + cacheRegion + "'");
                    manager.addCache(cacheRegion);
                    cache = manager.getCache(cacheRegion);
                    log.debug("started EHCache region: " + cacheRegion);
                }
                caches.put(cacheRegion, cache);
            }
View Full Code Here

    public void initCacheManager() {
        log.info("instantiating EHCacheManager from /ehcache.xml");
        // Do NOT use the CacheManage.create() factory methods, as they create a singleton! Our applicatoin
        // has to have its own CacheManager instance, so that we can run several applications in the same
        // JVM or application server.
        manager = new CacheManager();

        if (isRegisterMonitoring()) {
            // Register statistics MBean of EHCache on the current MBean server
            log.info("registering EHCache monitoring MBean");
            MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
View Full Code Here

      LOGGER.info("Configuring Cache from {} ",
          configFile.getAbsolutePath());
      InputStream in = null;
      try {
        in = processConfig(new FileInputStream(configFile), properties);
        cacheManager = new CacheManager(in);
      } finally {
        if (in != null) {
          in.close();
        }
      }
    } else {
      LOGGER.info("Configuring Cache from Classpath Default {} ",
          CONFIG_PATH);
      InputStream in = processConfig(this.getClass().getClassLoader()
          .getResourceAsStream(CONFIG_PATH), properties);
      if (in == null) {
        throw new IOException(
            "Unable to open config at classpath location "
                + CONFIG_PATH);
      }
      cacheManager = new CacheManager(in);
      in.close();
    }

    final WeakReference<CacheManagerServiceImpl> ref = new WeakReference<CacheManagerServiceImpl>(
        this);
View Full Code Here

public class RetryLimitHashedCredentialsMatcher extends HashedCredentialsMatcher {

    private Ehcache passwordRetryCache;

    public RetryLimitHashedCredentialsMatcher() {
        CacheManager cacheManager = CacheManager.newInstance(CacheManager.class.getClassLoader().getResource("ehcache.xml"));
        passwordRetryCache = cacheManager.getCache("passwordRetryCache");
    }
View Full Code Here

public class RetryLimitHashedCredentialsMatcher extends HashedCredentialsMatcher {

    private Ehcache passwordRetryCache;

    public RetryLimitHashedCredentialsMatcher() {
        CacheManager cacheManager = CacheManager.newInstance(CacheManager.class.getClassLoader().getResource("ehcache.xml"));
        passwordRetryCache = cacheManager.getCache("passwordRetryCache");
    }
View Full Code Here

public class RetryLimitHashedCredentialsMatcher extends HashedCredentialsMatcher {

    private Ehcache passwordRetryCache;

    public RetryLimitHashedCredentialsMatcher() {
        CacheManager cacheManager = CacheManager.create(CacheManager.class.getClassLoader().getResource("password-ehcache.xml"));
        passwordRetryCache = cacheManager.getCache("passwordRetryCache");
    }
View Full Code Here

TOP

Related Classes of net.sf.ehcache.CacheManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.