org.dcm4che2.filecache
Class FileCache

java.lang.Object
  extended by org.dcm4che2.filecache.FileCache

public class FileCache
extends java.lang.Object

Since:
Mar 4, 2009
Version:
$Revision$ $Date$
Author:
Gunter Zeilinger

Constructor Summary
FileCache()
           
 
Method Summary
 void clearCache()
          Delete everything in the cache
static boolean deleteFileAndParents(java.io.File f, java.io.File baseDir)
           
static boolean deleteFileOrDirectory(java.io.File f)
           
static void deleteFilesOrDirectories(java.io.File[] files)
           
 long free(long size)
          Free at least the indicated number of bytes from the filesystem, using an LRU algorithm
 java.io.File getCacheRootDir()
           
 java.lang.String getJournalFileName()
           
 java.lang.String getJournalFilePathFormat()
           
 java.io.File getJournalRootDir()
           
 long getMaximumFreeTime()
          Gets the maximum free time that a free should take, before another process can assume it is failed/gone, in ms Default: 1 hour.
 boolean isEmpty()
           
protected  boolean multiProcessFreeIsRunningFile()
          Return true if the free is running file was created, or is very old.
 void record(java.io.File f)
          Record a newly created file in the journaling cache, (default instance)
 void record(java.io.File f, boolean update)
          Record a file in the journaling cache, touching it to update the timestamp if update is true.
 void setCacheRootDir(java.io.File cacheRootDir)
           
 void setJournalFileName(java.lang.String journalFileName)
           
 void setJournalFilePathFormat(java.lang.String format)
           
 void setJournalRootDir(java.io.File journalRootDir)
          Sets the journal directory to store information about newly created files.
 void setMaximumFreeTime(long maximumFreeTime)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileCache

public FileCache()
Method Detail

getJournalRootDir

public java.io.File getJournalRootDir()

setJournalRootDir

public void setJournalRootDir(java.io.File journalRootDir)
Sets the journal directory to store information about newly created files.

Parameters:
journalRootDir -

getJournalFileName

public java.lang.String getJournalFileName()

setJournalFileName

public void setJournalFileName(java.lang.String journalFileName)

getCacheRootDir

public java.io.File getCacheRootDir()

setCacheRootDir

public void setCacheRootDir(java.io.File cacheRootDir)

getJournalFilePathFormat

public java.lang.String getJournalFilePathFormat()

setJournalFilePathFormat

public void setJournalFilePathFormat(java.lang.String format)

record

public void record(java.io.File f)
            throws java.io.IOException
Record a newly created file in the journaling cache, (default instance)

Throws:
java.io.IOException

record

public void record(java.io.File f,
                   boolean update)
            throws java.io.IOException
Record a file in the journaling cache, touching it to update the timestamp if update is true.

Throws:
java.io.IOException

multiProcessFreeIsRunningFile

protected boolean multiProcessFreeIsRunningFile()
Return true if the free is running file was created, or is very old. Create a free is running file to prevent other instances from freeing at the same time.


getMaximumFreeTime

public long getMaximumFreeTime()
Gets the maximum free time that a free should take, before another process can assume it is failed/gone, in ms Default: 1 hour.


setMaximumFreeTime

public void setMaximumFreeTime(long maximumFreeTime)

free

public long free(long size)
          throws java.io.IOException
Free at least the indicated number of bytes from the filesystem, using an LRU algorithm

Throws:
java.io.IOException

clearCache

public void clearCache()
Delete everything in the cache


isEmpty

public boolean isEmpty()

deleteFilesOrDirectories

public static void deleteFilesOrDirectories(java.io.File[] files)

deleteFileOrDirectory

public static boolean deleteFileOrDirectory(java.io.File f)

deleteFileAndParents

public static boolean deleteFileAndParents(java.io.File f,
                                           java.io.File baseDir)


Copyright © 2011 dcm4che. All Rights Reserved.