org.compass.core.lucene.engine.store.localcache
Class MemoryDirectoryCache

java.lang.Object
  extended by org.apache.lucene.store.Directory
      extended by org.compass.core.lucene.engine.store.localcache.MemoryDirectoryCache
All Implemented Interfaces:
DirectoryWrapper

public class MemoryDirectoryCache
extends Directory
implements DirectoryWrapper

Evictable Memory based directory cache wrapping the actual Lucene Directory the index uses. Accepts connection string parameters: bucketSize which is the size of each bucket entry (defaults to 1024 bytes), size which controls the maximum amount of memory that will be taken by the cache before entries will start to be evicted (defaults to 64m), and cacheFileNames that controls if file names will try to be cached as well (defaults to true).

Author:
kimchy

Field Summary
 
Fields inherited from class org.apache.lucene.store.Directory
lockFactory
 
Constructor Summary
MemoryDirectoryCache(String connectionString, Directory dir, LocalCacheManager localCacheManager)
           
 
Method Summary
 void clearLock(String name)
           
 void clearWrapper()
           
 void close()
           
 IndexOutput createOutput(String name)
           
 void deleteFile(String name)
           
 boolean fileExists(String name)
           
 long fileLength(String name)
           
 long fileModified(String name)
           
 int getBucketSize()
           
 LockFactory getLockFactory()
           
 String getLockID()
           
 Directory getWrappedDirectory()
           
 String[] list()
           
 Lock makeLock(String name)
           
 IndexInput openInput(String name)
           
 IndexInput openInput(String name, int bufferSize)
           
 void renameFile(String from, String to)
           
 void setLockFactory(LockFactory lockFactory)
           
 void touchFile(String name)
           
 
Methods inherited from class org.apache.lucene.store.Directory
copy, ensureOpen, sync
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryDirectoryCache

public MemoryDirectoryCache(String connectionString,
                            Directory dir,
                            LocalCacheManager localCacheManager)
Method Detail

getBucketSize

public int getBucketSize()

getWrappedDirectory

public Directory getWrappedDirectory()
Specified by:
getWrappedDirectory in interface DirectoryWrapper

clearWrapper

public void clearWrapper()
                  throws IOException
Specified by:
clearWrapper in interface DirectoryWrapper
Throws:
IOException

list

public String[] list()
              throws IOException
Specified by:
list in class Directory
Throws:
IOException

fileExists

public boolean fileExists(String name)
                   throws IOException
Specified by:
fileExists in class Directory
Throws:
IOException

fileModified

public long fileModified(String name)
                  throws IOException
Specified by:
fileModified in class Directory
Throws:
IOException

touchFile

public void touchFile(String name)
               throws IOException
Specified by:
touchFile in class Directory
Throws:
IOException

deleteFile

public void deleteFile(String name)
                throws IOException
Specified by:
deleteFile in class Directory
Throws:
IOException

renameFile

public void renameFile(String from,
                       String to)
                throws IOException
Specified by:
renameFile in class Directory
Throws:
IOException

fileLength

public long fileLength(String name)
                throws IOException
Specified by:
fileLength in class Directory
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in class Directory
Throws:
IOException

makeLock

public Lock makeLock(String name)
Overrides:
makeLock in class Directory

clearLock

public void clearLock(String name)
               throws IOException
Overrides:
clearLock in class Directory
Throws:
IOException

setLockFactory

public void setLockFactory(LockFactory lockFactory)
Overrides:
setLockFactory in class Directory

getLockFactory

public LockFactory getLockFactory()
Overrides:
getLockFactory in class Directory

getLockID

public String getLockID()
Overrides:
getLockID in class Directory

createOutput

public IndexOutput createOutput(String name)
                         throws IOException
Specified by:
createOutput in class Directory
Throws:
IOException

openInput

public IndexInput openInput(String name)
                     throws IOException
Specified by:
openInput in class Directory
Throws:
IOException

openInput

public IndexInput openInput(String name,
                            int bufferSize)
                     throws IOException
Overrides:
openInput in class Directory
Throws:
IOException


Copyright (c) 2004-2009 The Compass Project.