dk.netarkivet.archive.indexserver
Class MultiFileBasedCache<T extends java.lang.Comparable<T>>

java.lang.Object
  extended by dk.netarkivet.archive.indexserver.FileBasedCache<java.util.Set<T>>
      extended by dk.netarkivet.archive.indexserver.MultiFileBasedCache<T>
Type Parameters:
T - The cache type, must extend java.lang.Comparable.
Direct Known Subclasses:
CombiningMultiFileBasedCache, IndexRequestClient

public abstract class MultiFileBasedCache<T extends java.lang.Comparable<T>>
extends FileBasedCache<java.util.Set<T>>

Implementation of file based cache, that works with the assumption we are working on a set if ids, of which we might only get a subset correct. Implements generating a filename from this.


Field Summary
 
Fields inherited from class dk.netarkivet.archive.indexserver.FileBasedCache
cacheDir
 
Constructor Summary
MultiFileBasedCache(java.lang.String cacheName)
          Creates a new FileBasedCache object.
 
Method Summary
 java.io.File getCacheFile(java.util.Set<T> ids)
          Get the filename for the file containing the combined data for a set of IDs.
 
Methods inherited from class dk.netarkivet.archive.indexserver.FileBasedCache
cache, cacheData, get, getCacheDir, getIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiFileBasedCache

public MultiFileBasedCache(java.lang.String cacheName)
Creates a new FileBasedCache object. This creates a directory under the main cache directory holding cached files.

Parameters:
cacheName - Name of this cache (enabling sharing among processes). The directoriy creating in the cachedir will have this name.
Method Detail

getCacheFile

public java.io.File getCacheFile(java.util.Set<T> ids)
Get the filename for the file containing the combined data for a set of IDs.

Specified by:
getCacheFile in class FileBasedCache<java.util.Set<T extends java.lang.Comparable<T>>>
Parameters:
ids - A set of IDs to generate a filename for
Returns:
A filename that uniquely identifies this set of IDs within the cache. It is considered acceptable to have collisions at a likelihood the order of 1/2^128 (i.e. use MD5 to abbreviate long lists).