Package org.fjank.jcache.persistence

Examples of org.fjank.jcache.persistence.DiskCache


        if (parentCacheObject.contains(name)) {
            object = parentCacheObject.get(name);
        } else if (name instanceof Serializable) {
            //second, check the disk cache.
            try {
                DiskCache diskCache = CacheImpl.getCache().getDiskCache();
                if (diskCache != null) {
                    object = diskCache.getObject((Serializable) name);
                    if (object == null) {
                        return null;
                    }
                }
            } catch (DiskCacheException e) {
View Full Code Here


        CacheObject o = new CacheObject(name, object, objGr, region, CacheImpl.getCache().getReferenceQueue());
        o.setAttributes(attributes);
        int maxObjects = CacheImpl.getCache().getAttributes().getMaxObjects();
        int currentObjectCount = getCurrentObjectCount();
        if (currentObjectCount >= maxObjects) {
            DiskCache diskCache = CacheImpl.getCache().getDiskCache();
            if (diskCache == null) {
                //no disk, and memory is full.
                this.lastException = CacheFullException.class;
                this.lastMessage = "The maximum number of objects in the cache has been reached.";
                return false;
            }
            boolean updated = diskCache.update(o);
            if (!updated) {
                this.lastException = CacheFullException.class;
                this.lastMessage = "The maximum size for the diskCache has been reached.";
            }
            return updated;
        }
        if ((attributes != null) && (attributes.getSize() != 0)) {
            if ((region.getCurrentSize() + attributes.getSize()) > (CacheImpl.getCache().getAttributes().getMemoryCacheSize() * 1024 * 1024)) {
                DiskCache diskCache = CacheImpl.getCache().getDiskCache();
                if (diskCache == null) {
                    //no disk, and memory is full.
                    this.lastException = CacheFullException.class;
                    this.lastMessage = "The maximum size for the memory cache has been reached.";
                    return false;
                }
                boolean updated = diskCache.update(o);
                if (!updated) {
                    this.lastException = CacheFullException.class;
                    this.lastMessage = "The maximum size for the diskCache has been reached.";
                }
                return updated;
View Full Code Here

                this.attributes = attributes;
                attributes.registerCache(this);
                startServiceThreads();
                if (attributes.getDiskPath() != null) {
                     try {
                        diskCache = new DiskCache(attributes);
                    } catch (DiskCacheException e) {
                        throw new CacheNotAvailableException(e);
                    }
                }
                if (attributes.isDistributed()) {
View Full Code Here

TOP

Related Classes of org.fjank.jcache.persistence.DiskCache

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.