Java Doc for CacheManager.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » services » 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 » Database DBMS » db derby 10.2 » org.apache.derby.iapi.services.cache 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.derby.iapi.services.cache.CacheManager

All known Subclasses:   org.apache.derby.impl.services.cache.Clock,
CacheManager
public interface CacheManager (Code)




Method Summary
public  voidageOut()
     Age as many objects as possible out of the cache.
public  voidclean(Matchable partialKey)
     Clean all objects that match the partialKey (or exact key). Any cached object that results in the partialKey.equals(Object) method returning true when passed the cached object will be cleaned.
public  voidcleanAll()
     Place all objects in their clean state by calling their clean method if they are dirty.
public  booleancontainsKey(Object key)
     Determine whether a key is in the cache.
public  Cacheablecreate(Object key, Object createParameter)
     Create an object in the cache.
public  booleandiscard(Matchable partialKey)
     Discard all objects that match the partialKey (or exact key). Any cached object that results in the partialKey.equals(Object) method returning true when passed the cached object will be thrown out of the cache if and only if it is not in use.
public  Cacheablefind(Object key)
     Find an object in the cache.

Find an object in the cache that matches the key provided using the equals() method, i.e.

public  CacheablefindCached(Object key)
     Find an object in the cache.

Find an object in the cache that matches the key provided using the equals() method, i.e.

public  long[]getCacheStats()
     Return statistics about cache that may be implemented.
public  longgetMaximumSize()
    
public  intgetNumberInUse()
     Report the number of items in use (with Identity) in this cache.
public  voidrelease(Cacheable entry)
     Release a Cacheable object previously found with find() or findCached().
public  voidremove(Cacheable entry)
     Delete and remove an object from the cache.
public  voidresetCacheStats()
     reset the cache statistics to 0.
public  voidresize(long newSize)
     Change the maximum size of the cache.
public  voidscan(Matchable filter, Operator operator)
     Perform an operation on (approximately) all entries that matches the filter, or all entries if the filter is null.
public  voidsetUsed(Object[] keys)
     Mark a set of entries as having been used.
public  voidshutdown()
     Shutdown the cache.
public  voiduseDaemonService(DaemonService daemon)
    



Method Detail
ageOut
public void ageOut()(Code)
Age as many objects as possible out of the cache. This call is guaranteed not to block. It is not guaranteed to leave the cache empty.
It is guaranteed that all unkept, clean objects will be removed from the cache.
See Also:   Cacheable.clean
See Also:   Cacheable.clearIdentity



clean
public void clean(Matchable partialKey) throws StandardException(Code)
Clean all objects that match the partialKey (or exact key). Any cached object that results in the partialKey.equals(Object) method returning true when passed the cached object will be cleaned.

In order to clean more than one object the Cacheable equals method must be able to handle a partial key, e.g. a page has PageKey but a clean may pass a ContainerKey which will discard all pages in that container.
exception:
  StandardException - Standard Cloudscape error policy.




cleanAll
public void cleanAll() throws StandardException(Code)
Place all objects in their clean state by calling their clean method if they are dirty. This method guarantees that all objects that existed in the cache at the time of the call are placed in the clean state sometime during this call. Objects that are added to the cache during this call or objects that are dirtied during this call (by other callers) are not guaranteed to be clean once this call returns.
See Also:   Cacheable.clean
See Also:   Cacheable.isDirty
exception:
  StandardException - Standard Cloudscape error policy.



containsKey
public boolean containsKey(Object key)(Code)
Determine whether a key is in the cache. WARNING: This method does not keep a lock on the entry or the cache, so the return value could be made incorrect by the time that this method returns. Therefore this method should only be used for statistical purposes.



create
public Cacheable create(Object key, Object createParameter) throws StandardException(Code)
Create an object in the cache. The resulting object will match the key provided using the equals() method, i.e. the return Cacheable will have getIdentifier.equals(key) true. If an object that matches the key already exists in the cache then an exception is thrown.
The object will be added by one of:
  • creating a new holder object and calling its initParameter() method and then its createIdentity() method with key as the parameter.
  • Calling clearIdentity() on an holder object in the clean state and then calling its createIdentity() method with key as the parameter.
  • Calling clean() on a dirty holder object and then calling clearIdentity() on an holder object in the clean state and then calling its createIdentity() method with key as the parameter.
In all cases the setIdentity() method is called with the createParameter as the second argument. If the object cannot be created then an exception is thrown by createIdentity.
The returned object is kept, i.e. its identity will not change, until the release() method is called. The release() method must be called after the caller is finished with the object and throw away the reference to it, e.g.
 Page p = (Page) pageCache.create(pageKey, createType);
 // do stuff with p
 // release p
 pageCache.release(p);
 p = null;
 
A reference to an object in the cache.
exception:
  StandardException - Standard Cloudscape error policy.
See Also:   Cacheable.createIdentity



discard
public boolean discard(Matchable partialKey)(Code)
Discard all objects that match the partialKey (or exact key). Any cached object that results in the partialKey.equals(Object) method returning true when passed the cached object will be thrown out of the cache if and only if it is not in use. The Cacheable will be discarded without its clean method being called.

If partialKey is null, it matches all objects. This is a way to discard all objects from the cache in case of emergency shutdown.

In order to discard more than one object the Cacheable equals method must be able to handle a partial key, e.g. a page has PageKey but a discard may pass a ContainerKey which will discard all pages in that container.

true if discard has successful gotten rid of all objects thatmatch the partial or exact key. False if some objects that matcheswere not gotten rid of because it was kept.




find
public Cacheable find(Object key) throws StandardException(Code)
Find an object in the cache.

Find an object in the cache that matches the key provided using the equals() method, i.e. the return Cacheable will have getIdentifier.equals(key) true. If the object does not exist in the cache it will be added by one of:

  • creating a new holder object and calling its initParameter() method and then its setIdentity() method with key as the parameter.
  • Calling clearIdentity() on an holder object in the clean state and then calling its setIdentity() method with key as the parameter.
  • Calling clean() on a dirty holder object and then calling clearIdentity() on an holder object in the clean state and then calling its setIdentity() method with key as the parameter.
In all cases the setIdentity() method is called with forCreate set to false.
The returned object is kept, i.e. its identity will not change, until the release() method is called. The release() method must be called after the caller is finished with the object and throw away the reference to it, e.g.
 Page p = (Page) pageCache.find(pageKey);
 // do stuff with p
 // release p
 pageCache.release(p);
 p = null;
 
A reference to an object in the cache, or null if the object cannot be found.
exception:
  StandardException - Standard Cloudscape error policy.
See Also:   Cacheable.setIdentity



findCached
public Cacheable findCached(Object key) throws StandardException(Code)
Find an object in the cache.

Find an object in the cache that matches the key provided using the equals() method, i.e. the return Cacheable will have getIdentifier.equals(key) true. If a matching object does not exist in the cache, null is returned.
The returned object is kept, i.e. its identity will not change, until the release() method is called. The release() method must be called after the caller is finished with the object and throw away the reference to it, e.g.

 Page p = (Page) pageCache.findCached(pageKey);
 if (p != null) {
 // do stuff with p
 // release p
 pageCache.release(p);
 p = null;
 }
 

exception:
  StandardException - Standard Cloudscape error policy.



getCacheStats
public long[] getCacheStats()(Code)
Return statistics about cache that may be implemented.



getMaximumSize
public long getMaximumSize()(Code)
the current maximum size of the cache.



getNumberInUse
public int getNumberInUse()(Code)
Report the number of items in use (with Identity) in this cache.



release
public void release(Cacheable entry)(Code)
Release a Cacheable object previously found with find() or findCached(). After this call the caller must throw away the reference to item.



remove
public void remove(Cacheable entry) throws StandardException(Code)
Delete and remove an object from the cache. It is up to the user of the cache to provide synchronization of some form that ensures that only one caller executes remove() on a cached object.
The object must have previously been found with find() or findCached(). The item will be placed into the NoIdentity state through clean(true) (if required) and clearIdentity(). The removal of the object will be delayed until it is not kept by anyone. Objects that are in the to be removed state can still be found through find() and findCached() until their keep count drops to zero. This call waits until the object has been removed.
After this call the caller must throw away the reference to item.
exception:
  StandardException - Standard Cloudscape error policy.



resetCacheStats
public void resetCacheStats()(Code)
reset the cache statistics to 0.



resize
public void resize(long newSize) throws StandardException(Code)
Change the maximum size of the cache. If the size is decreased then cache entries will be thrown out.
Parameters:
  newSize - the new maximum cache size
exception:
  StandardException - Cloudscape Standard error policy



scan
public void scan(Matchable filter, Operator operator)(Code)
Perform an operation on (approximately) all entries that matches the filter, or all entries if the filter is null. Entries that are added while the cache is being scanned might or might not be missed.
Parameters:
  filter -
Parameters:
  operator -



setUsed
public void setUsed(Object[] keys)(Code)
Mark a set of entries as having been used. Normally this is done as a side effect of find() or findCached. If the entry has been replaced then this method does nothing.
Parameters:
  keys - the key of the used entry.



shutdown
public void shutdown() throws StandardException(Code)
Shutdown the cache. This call stops the cache returning any more valid references on a find() or findCached() call, and then cleanAll() and ageOut() are called. The cache remains in existence until the last kept object has been unkept.
exception:
  StandardException - Standard Cloudscape error policy.



useDaemonService
public void useDaemonService(DaemonService daemon)(Code)
This cache can use this DaemonService if it needs some work to be done int he background



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