Java Doc for FileCache.java in  » Portal » jetspeed-2.1.3 » org » apache » jetspeed » cache » file » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » jetspeed 2.1.3 » org.apache.jetspeed.cache.file 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.jetspeed.cache.file.FileCache

FileCache
public class FileCache implements java.util.Comparator(Code)
FileCache keeps a cache of files up-to-date with a most simple eviction policy. The eviction policy will keep n items in the cache, and then start evicting the items ordered-by least used first. The cache runs a thread to check for both evictions and refreshes.
author:
   David S. Taylor David Sean Taylor
version:
   $Id: FileCache.java 516448 2007-03-09 16:25:47Z ate $

Inner Class :protected class FileCacheScanner extends Thread

Field Summary
protected  Listlisteners
    
protected  intmaxSize
    
protected  longscanRate
    

Constructor Summary
public  FileCache()
     Default constructor.
public  FileCache(long scanRate, int maxSize)
    
public  FileCache(int initialCapacity, int loadFactor, long scanRate, int maxSize)
    

Method Summary
public  voidaddListener(FileCacheEventListener listener)
    
public  intcompare(Object o1, Object o2)
    
protected  voidevict()
    
public  voidevictAll()
    
public  FileCacheEntryget(String key)
    
public  ObjectgetDocument(String key)
    
public  IteratorgetIterator()
    
public  intgetMaxSize()
    
public  longgetScanRate()
    
public  intgetSize()
    
public  voidput(File file, Object document)
    
public  voidput(String key, Object document, File rootFile)
    
public  Objectremove(String key)
    
public  voidsetMaxSize(int maxSize)
    
public  voidsetScanRate(long scanRate)
     Set the new refresh scan rate on managed files.
public  voidstartFileScanner()
     Start the file Scanner running at the current scan rate.
public  voidstopFileScanner()
    

Field Detail
listeners
protected List listeners(Code)



maxSize
protected int maxSize(Code)



scanRate
protected long scanRate(Code)




Constructor Detail
FileCache
public FileCache()(Code)
Default constructor. Use default values for scanReate and maxSize



FileCache
public FileCache(long scanRate, int maxSize)(Code)
Set scanRate and maxSize
Parameters:
  scanRate - how often in seconds to refresh and evict from the cache
Parameters:
  maxSize - the maximum allowed size of the cache before eviction starts



FileCache
public FileCache(int initialCapacity, int loadFactor, long scanRate, int maxSize)(Code)
Set all parameters on the cache
Parameters:
  initialCapacity - the initial size of the cache as passed to HashMap
Parameters:
  loadFactor - how full the hash table is allowed to get before increasing
Parameters:
  scanRate - how often in seconds to refresh and evict from the cache
Parameters:
  maxSize - the maximum allowed size of the cache before eviction starts




Method Detail
addListener
public void addListener(FileCacheEventListener listener)(Code)
Add a File Cache Event Listener
Parameters:
  listener - the event listener



compare
public int compare(Object o1, Object o2)(Code)
Comparator function for sorting by last accessed during eviction



evict
protected void evict()(Code)
Evicts entries based on last accessed time stamp



evictAll
public void evictAll()(Code)
Evicts all entries



get
public FileCacheEntry get(String key)(Code)
Gets an entry from the cache given a key
Parameters:
  key - the key to look up the entry by the entry



getDocument
public Object getDocument(String key)(Code)
Gets an entry from the cache given a key
Parameters:
  key - the key to look up the entry by the entry



getIterator
public Iterator getIterator()(Code)
get an iterator over the cache values iterator over the cache values



getMaxSize
public int getMaxSize()(Code)
Get the maximum size of the cache the current maximum size of the cache



getScanRate
public long getScanRate()(Code)
Get the refresh scan rate the current refresh scan rate in seconds



getSize
public int getSize()(Code)
get the size of the cache the size of the cache



put
public void put(File file, Object document) throws java.io.IOException(Code)
Puts a file entry in the file cache
Parameters:
  file - The file to be put in the cache
Parameters:
  document - the cached document



put
public void put(String key, Object document, File rootFile) throws java.io.IOException(Code)
Puts a file entry in the file cache
Parameters:
  path - the full path name of the file
Parameters:
  document - the cached document



remove
public Object remove(String key)(Code)
Removes a file entry from the file cache
Parameters:
  key - the full path name of the file the entry removed



setMaxSize
public void setMaxSize(int maxSize)(Code)
Set the new maximum size of the cache
Parameters:
  maxSize - the maximum size of the cache



setScanRate
public void setScanRate(long scanRate)(Code)
Set the new refresh scan rate on managed files.
Parameters:
  scanRate - the new scan rate in seconds



startFileScanner
public void startFileScanner()(Code)
Start the file Scanner running at the current scan rate.



stopFileScanner
public void stopFileScanner()(Code)
Stop the file Scanner



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.