org.outerj.daisy.cache.impl
Class DocumentCacheImpl

java.lang.Object
  extended byorg.outerj.daisy.cache.impl.DocumentCacheImpl
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, DocumentCache, DocumentCacheImplMBean, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.service.Serviceable

public class DocumentCacheImpl
extends java.lang.Object
implements DocumentCache, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.service.Serviceable, DocumentCacheImplMBean

Implementation of DocumentCache that uses a LRUMap with a configurable limit. JMX manageable.


Constructor Summary
DocumentCacheImpl()
           
 
Method Summary
 void clear()
          Clears the entire cache.
 void clearCache()
           
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 org.outerj.daisy.repository.commonimpl.DocumentImpl get(long documentId, long branchId, long languageId)
          Returns the cached Document, or null if it is not in the cache.
 int getAvailableVariantCacheCurrentSize()
           
 int getAvailableVariantCacheMaxSize()
           
 org.outerj.daisy.repository.AvailableVariants getAvailableVariants(long documentId)
           
 int getDocumentCacheCurrentSize()
           
 int getDocumentCacheMaxSize()
           
 void initialize()
           
 void put(long documentId, org.outerj.daisy.repository.AvailableVariants availableVariants)
           
 void put(long documentId, long branchId, long languageId, org.outerj.daisy.repository.commonimpl.DocumentImpl document)
           
 void remove(long documentId)
          Removes all cached variants of the document.
 void remove(long documentId, long branchId, long languageId)
          Removes a cached Document, or does nothing if it is not in the cache.
 void removeAvailableVariants(long documentId)
           
 void service(org.apache.avalon.framework.service.ServiceManager serviceManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentCacheImpl

public DocumentCacheImpl()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

service

public void service(org.apache.avalon.framework.service.ServiceManager serviceManager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception

clear

public void clear()
Description copied from interface: DocumentCache
Clears the entire cache. Should only be used exceptionally to avoid performance drops.

Specified by:
clear in interface DocumentCache

put

public void put(long documentId,
                long branchId,
                long languageId,
                org.outerj.daisy.repository.commonimpl.DocumentImpl document)
Specified by:
put in interface DocumentCache

get

public org.outerj.daisy.repository.commonimpl.DocumentImpl get(long documentId,
                                                               long branchId,
                                                               long languageId)
Description copied from interface: DocumentCache
Returns the cached Document, or null if it is not in the cache.

Specified by:
get in interface DocumentCache

remove

public void remove(long documentId)
Description copied from interface: DocumentCache
Removes all cached variants of the document.

Specified by:
remove in interface DocumentCache

remove

public void remove(long documentId,
                   long branchId,
                   long languageId)
Description copied from interface: DocumentCache
Removes a cached Document, or does nothing if it is not in the cache.

Specified by:
remove in interface DocumentCache

put

public void put(long documentId,
                org.outerj.daisy.repository.AvailableVariants availableVariants)
Specified by:
put in interface DocumentCache

getAvailableVariants

public org.outerj.daisy.repository.AvailableVariants getAvailableVariants(long documentId)
Specified by:
getAvailableVariants in interface DocumentCache

removeAvailableVariants

public void removeAvailableVariants(long documentId)
Specified by:
removeAvailableVariants in interface DocumentCache

getDocumentCacheMaxSize

public int getDocumentCacheMaxSize()
Specified by:
getDocumentCacheMaxSize in interface DocumentCacheImplMBean

getDocumentCacheCurrentSize

public int getDocumentCacheCurrentSize()
Specified by:
getDocumentCacheCurrentSize in interface DocumentCacheImplMBean

getAvailableVariantCacheMaxSize

public int getAvailableVariantCacheMaxSize()
Specified by:
getAvailableVariantCacheMaxSize in interface DocumentCacheImplMBean

getAvailableVariantCacheCurrentSize

public int getAvailableVariantCacheCurrentSize()
Specified by:
getAvailableVariantCacheCurrentSize in interface DocumentCacheImplMBean

clearCache

public void clearCache()
Specified by:
clearCache in interface DocumentCacheImplMBean


Copyright © -2005 . All Rights Reserved.