Java Doc for Cache.java in  » Ajax » Laszlo-4.0.10 » org » openlaszlo » cache » 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 » Ajax » Laszlo 4.0.10 » org.openlaszlo.cache 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.openlaszlo.cache.Cache

All known Subclasses:   org.openlaszlo.cm.CompilationManager,  org.openlaszlo.cache.RequestCache,  org.openlaszlo.cache.PersistentMap,  org.openlaszlo.compiler.CompilerMediaCache,  org.openlaszlo.sc.ScriptCompiler,
Cache
abstract public class Cache (Code)
A base class for maintaining a disk-backed cache of requests. Cache has 2 sequenced hash map of Items. Each item uniquely represents something to be cached (and transcoded). The first map contains items that are "in memory". Items that are "in memory" are also stored on disk. The second map contains items that are only on disk. The cache chucks out (via LRU) items from each map when it is beyond its maximum size for that map. Each time an item is requested, it is moved to the front of the "in-memory" map. Each item has its own lock. When an item is requested, we lock it and then go to the DataSource to see if we need to refresh any copy of it we have. When an item has it's size change or it marked dirty, it is also marked as needing its size changed reckoned with the cache sizes. Whenever the cache is locked and runs into an item that needs reckoning, it updates the cache sizes to reflect the item. The cache supports multiple encodings of individual items.
author:
   Eric Bloch

Inner Class :protected class Item implements Serializable

Field Summary
final public  StringDEFAULT_DISK_MAX
    
final public  StringDEFAULT_MEM_ITEM_MAX
    
final public  StringDEFAULT_MEM_MAX
    

Constructor Summary
public  Cache(String name, File cacheDirectory, Properties props)
     Creates a new Cache instance.

Method Summary
protected  voidafterCacheRead(Object metaData)
     this routine is a place holder which can be overridden to hook into the cache loading.
public synchronized  booleanclearCache()
    
public synchronized  voiddumpXML(StringBuffer buf, String name, boolean details)
    
protected synchronized  ItemfindItem(Serializable key, String enc, boolean doLockAndLeaveActive)
     Find and optionally lock item in the cache that matches this key If the item doesn't exist, create it.
public synchronized  longgetDiskSize()
    
protected synchronized  ItemgetItem(Serializable key)
    
public synchronized  longgetMaxDiskSize()
    
public synchronized  longgetMaxMemSize()
    
public synchronized  longgetMemSize()
    
public synchronized  voidsetMaxDiskSize(long size)
     Set the maximum size of the on-disk cache.
public synchronized  voidsetMaxMemSize(long size)
     Set the maxmimum size of the in-memory cache.
protected synchronized  voidupdateCache(Item item)
     Reckon this item and update the cache.
protected synchronized  voidupdateCacheAndDeactivateItem(Item item)
     Reckon and deactivate this item and update the cache.
public synchronized  voidupdateMapsAndReckonItems(boolean clearAll)
     Update the maps and remove items that push us beyond the maximum size of the cache.

Field Detail
DEFAULT_DISK_MAX
final public String DEFAULT_DISK_MAX(Code)



DEFAULT_MEM_ITEM_MAX
final public String DEFAULT_MEM_ITEM_MAX(Code)



DEFAULT_MEM_MAX
final public String DEFAULT_MEM_MAX(Code)




Constructor Detail
Cache
public Cache(String name, File cacheDirectory, Properties props) throws IOException(Code)
Creates a new Cache instance.
Parameters:
  name -
Parameters:
  cacheDirectory - a File naming a directorywhere cache files should be kept
Parameters:
  props -




Method Detail
afterCacheRead
protected void afterCacheRead(Object metaData)(Code)
this routine is a place holder which can be overridden to hook into the cache loading. It is used by the cm/CompilationManager to get at the contents of the dependencyTracker as it is being loaded from disk and modify various paths that might have changed since prefetching.



clearCache
public synchronized boolean clearCache()(Code)
Clear the cache



dumpXML
public synchronized void dumpXML(StringBuffer buf, String name, boolean details)(Code)
Dump textual XML representation of cache to buf
Parameters:
  buf - buffer to append
Parameters:
  name - name for XML element
Parameters:
  details - if true, dump details



findItem
protected synchronized Item findItem(Serializable key, String enc, boolean doLockAndLeaveActive) throws IOException(Code)
Find and optionally lock item in the cache that matches this key If the item doesn't exist, create it. If the item does exist, move it to the top of the LRU list by removing and re-adding. the locked item



getDiskSize
public synchronized long getDiskSize()(Code)
Get the current size of the on-disk cache



getItem
protected synchronized Item getItem(Serializable key)(Code)
an item if it exists or null otherwise



getMaxDiskSize
public synchronized long getMaxDiskSize()(Code)
Get the maximum size of the on-disk cache cache



getMaxMemSize
public synchronized long getMaxMemSize()(Code)
Get the maxmimum size of the in-memory cache



getMemSize
public synchronized long getMemSize()(Code)
Get the current size of the in-memory cache



setMaxDiskSize
public synchronized void setMaxDiskSize(long size)(Code)
Set the maximum size of the on-disk cache. Can cause the cache to remove things.



setMaxMemSize
public synchronized void setMaxMemSize(long size)(Code)
Set the maxmimum size of the in-memory cache. Can cause the cache to remove things.



updateCache
protected synchronized void updateCache(Item item)(Code)
Reckon this item and update the cache.



updateCacheAndDeactivateItem
protected synchronized void updateCacheAndDeactivateItem(Item item)(Code)
Reckon and deactivate this item and update the cache.



updateMapsAndReckonItems
public synchronized void updateMapsAndReckonItems(boolean clearAll)(Code)
Update the maps and remove items that push us beyond the maximum size of the cache. Never empty out the maps. Always leave at least one item if clearAll is false. Also ignore items that are in progress.
Parameters:
  clearAll - if false, must leave one elt in each map



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.