Package org.fjank.jcache

Examples of org.fjank.jcache.DiskCacheObject


     * Adds the provided element to the cache.
     *
     * @param cacheElement the element to add.
     */
    public final boolean update(final CacheObject cacheElement) {
        byte[] data = CacheFileAdapter.serialize(new DiskCacheObject(cacheElement));
        int newSize = currentSize+data.length;
    int maxSize = cattr.getDiskSize()*1024*1024;
    if(newSize>maxSize) {
          return false;
        }
View Full Code Here


        ObjectInputStream ois = null;
        try {
            ByteArrayInputStream bais = new ByteArrayInputStream(data);
            BufferedInputStream bis = new BufferedInputStream(bais);
            ois=new ObjectInputStream(bis);
            DiskCacheObject obj = (DiskCacheObject) ois.readObject();
            obj.getCacheObject().resetRefCount();
            return obj;
        } catch (IOException e) {
            throw new IllegalStateException("An exception occured when reading from the disk cache." +
                " Reason: " + e.getMessage());
        } catch (ClassNotFoundException e) {
View Full Code Here

TOP

Related Classes of org.fjank.jcache.DiskCacheObject

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.