Package net.sf.ehcache

Examples of net.sf.ehcache.Ehcache


     * Element can never be null. Add a null guard just in case.
     * @param key
     */
    protected void update(final Object key) {
        try {
            Ehcache backingCache = getCache();
            final Element element = backingCache.getQuiet(key);

            if (element == null) {
                if (LOG.isLoggable(Level.FINEST)) {
                    LOG.finest(getName() + ": entry with key " + key + " has been removed - skipping it");
                }
View Full Code Here


        // perform the refresh
        for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
            final Object key = iterator.next();

            try {
                Ehcache backingCache = getCache();
                final Element element = backingCache.getQuiet(key);

                if (element == null) {
                    if (LOG.isLoggable(Level.FINEST)) {
                        LOG.finest(getName() + ": entry with key " + key + " has been removed - skipping it");
                    }
View Full Code Here

     */
    public Element get(final Object key) throws LockTimeoutException {

        try {

            Ehcache backingCache = getCache();
            Element element = backingCache.get(key);

            if (element == null) {
                element = super.get(key);
            } else {
                Mutex lock = getLockForKey(key);
View Full Code Here

     */
    public Cache createCache(Map environment) throws CacheException {


        CacheLoader cacheLoader = null;
        Ehcache cache = null;
        try {
            String name = PropertyUtil.extractAndLogProperty("name", environment);

            String maxElementsInMemoryString = PropertyUtil.extractAndLogProperty("maxElementsInMemory", environment);
            int maxElementsInMemory = Integer.parseInt(maxElementsInMemoryString);
View Full Code Here

            cacheManager = EHCacheUtil.createCacheManager(conf);
        }
       
        CacheConfiguration cc = EHCacheUtil.getCacheConfiguration(CACHE_KEY, cacheManager);
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
    }
View Full Code Here

            cacheManager = EHCacheUtil.createCacheManager(conf);
        }
       
        CacheConfiguration cc = EHCacheUtil.getCacheConfiguration(CACHE_KEY, cacheManager);
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
    }
View Full Code Here

        // Cannot overflow to disk as SecurityToken Elements can't be serialized
        @SuppressWarnings("deprecation")
        CacheConfiguration cc = EHCacheManagerHolder.getCacheConfiguration(key, cacheManager)
            .overflowToDisk(false); //tokens not writable
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
       
        // Set the TimeToLive value from the CacheConfiguration
        ttl = cc.getTimeToLiveSeconds();
    }
View Full Code Here

        LOG.debug("Found an existing cache: {}", cacheName);

        if (LOG.isTraceEnabled()) {
            LOG.trace("Cache {} currently contains {} elements", cacheName, cacheManager.getCache(cacheName).getSize());
        }
        Ehcache cache = cacheManager.getCache(cacheName);

        if (!cache.isKeyInCache(key)) {
            LOG.debug("No Key with name: {} presently exists in the cache. It is also possible that the key may have expired in the cache."
                    + " Replacement will not be performed until an appropriate key/value pair is added to (or) found in the cache.", key);
            return false;
        }
View Full Code Here

            cacheManager = CacheManager.create();
        } else {
            cacheManager = CacheManager.create(configFileURL);
        }
       
        Ehcache newCache = new Cache(CACHE_KEY, 50000, true, false, DEFAULT_TTL, DEFAULT_TTL);
        cache = cacheManager.addCacheIfAbsent(newCache);
    }
View Full Code Here

            cacheManager = EHCacheUtil.createCacheManager(conf);
        }
       
        CacheConfiguration requestCC = EHCacheUtil.getCacheConfiguration(REQUEST_CACHE_KEY, cacheManager);
       
        Ehcache newCache = new Cache(requestCC);
        requestCache = cacheManager.addCacheIfAbsent(newCache);
       
        CacheConfiguration responseCC = EHCacheUtil.getCacheConfiguration(RESPONSE_CACHE_KEY, cacheManager);
       
        newCache = new Cache(responseCC);
View Full Code Here

TOP

Related Classes of net.sf.ehcache.Ehcache

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.