com.application.areca.cache
Class AbstractArchiveDataCache

java.lang.Object
  extended by com.application.areca.cache.AbstractArchiveDataCache
Direct Known Subclasses:
ArchiveManifestCache

public abstract class AbstractArchiveDataCache
extends java.lang.Object

Abstract cache implementation.
Data are indexed by :
- FileSystemArchiveMedium
- File

Author:
Olivier PETRUCCI

Areca Build ID : 7299034069467778562

Constructor Summary
AbstractArchiveDataCache(EvictionManager evictor)
           
 
Method Summary
protected  ArchiveDataMap findArchiveDataMap(AbstractFileSystemMedium medium)
           
 ArchiveDataMap findOrCreateArchiveDataMap(AbstractFileSystemMedium medium)
           
 java.lang.Object get(AbstractFileSystemMedium medium, java.io.File key)
           
protected  AbstractFileSystemMedium getLeastAccessedNonEmptyMapMedium()
          Return the medium that has been the least accessed ...
 boolean put(AbstractFileSystemMedium medium, java.io.File key, java.lang.Object data, long approximateDataSize)
          This method registers the object passed as argument in the cache associated to the medium.
 java.lang.Object remove(AbstractFileSystemMedium medium, java.io.File key)
          Remove an entry.
 void removeAllArchiveData()
          Clear the cache
 void removeAllArchiveData(AbstractFileSystemMedium medium)
          Clear all data for the medium passed as argument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractArchiveDataCache

public AbstractArchiveDataCache(EvictionManager evictor)
Method Detail

findOrCreateArchiveDataMap

public ArchiveDataMap findOrCreateArchiveDataMap(AbstractFileSystemMedium medium)

findArchiveDataMap

protected ArchiveDataMap findArchiveDataMap(AbstractFileSystemMedium medium)

get

public java.lang.Object get(AbstractFileSystemMedium medium,
                            java.io.File key)

put

public boolean put(AbstractFileSystemMedium medium,
                   java.io.File key,
                   java.lang.Object data,
                   long approximateDataSize)
This method registers the object passed as argument in the cache associated to the medium.
Once the object has been referenced, it checks that the cache still can grow.
If it still can grow, the method simply returns true (which means : "GC has not been called")
If it cannot grow anymore, the method returns false (which means : "GC has been called")

Note that, in both cases, the reference is added to the cache before GC is called.


remove

public java.lang.Object remove(AbstractFileSystemMedium medium,
                               java.io.File key)
Remove an entry.
Return the removed entry


removeAllArchiveData

public void removeAllArchiveData()
Clear the cache


removeAllArchiveData

public void removeAllArchiveData(AbstractFileSystemMedium medium)
Clear all data for the medium passed as argument


getLeastAccessedNonEmptyMapMedium

protected AbstractFileSystemMedium getLeastAccessedNonEmptyMapMedium()
Return the medium that has been the least accessed ...