Java Doc for GeneralCacheAdministrator.java in  » Cache » OSCache » com » opensymphony » oscache » general » 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
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Cache » OSCache » com.opensymphony.oscache.general 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.opensymphony.oscache.base.AbstractCacheAdministrator
      com.opensymphony.oscache.general.GeneralCacheAdministrator

GeneralCacheAdministrator
public class GeneralCacheAdministrator extends AbstractCacheAdministrator (Code)
A GeneralCacheAdministrator creates, flushes and administers the cache. EXAMPLES :

 // ---------------------------------------------------------------
 // Typical use with fail over
 // ---------------------------------------------------------------
 String myKey = "myKey";
 String myValue;
 int myRefreshPeriod = 1000;
 try {
 // Get from the cache
 myValue = (String) admin.getFromCache(myKey, myRefreshPeriod);
 } catch (NeedsRefreshException nre) {
 try {
 // Get the value (probably by calling an EJB)
 myValue = "This is the content retrieved.";
 // Store in the cache
 admin.putInCache(myKey, myValue);
 } catch (Exception ex) {
 // We have the current content if we want fail-over.
 myValue = (String) nre.getCacheContent();
 // It is essential that cancelUpdate is called if the
 // cached content is not rebuilt
 admin.cancelUpdate(myKey);
 }
 }
 // ---------------------------------------------------------------
 // Typical use without fail over
 // ---------------------------------------------------------------
 String myKey = "myKey";
 String myValue;
 int myRefreshPeriod = 1000;
 try {
 // Get from the cache
 myValue = (String) admin.getFromCache(myKey, myRefreshPeriod);
 } catch (NeedsRefreshException nre) {
 try {
 // Get the value (probably by calling an EJB)
 myValue = "This is the content retrieved.";
 // Store in the cache
 admin.putInCache(myKey, myValue);
 updated = true;
 } finally {
 if (!updated) {
 // It is essential that cancelUpdate is called if the
 // cached content could not be rebuilt
 admin.cancelUpdate(myKey);
 }
 }
 }
 // ---------------------------------------------------------------
 // ---------------------------------------------------------------
 

version:
   $Revision: 254 $
author:
   Francois Beauregard
author:
   Alain Bergevin



Constructor Summary
public  GeneralCacheAdministrator()
     Create the cache administrator.
public  GeneralCacheAdministrator(Properties p)
    

Method Summary
public  voidcancelUpdate(String key)
     Cancels a pending cache update.
public  voiddestroy()
     Shuts down the cache administrator.
public  voidflushAll()
     Flush the entire cache immediately.
public  voidflushAll(Date date)
     Flush the entire cache at the given date.
public  voidflushEntry(String key)
     Flushes a single cache entry.
public  voidflushGroup(String group)
     Flushes all items that belong to the specified group.
public  voidflushPattern(String pattern)
     Allows to flush all items that have a specified pattern in the key.
public  CachegetCache()
    
public  ObjectgetFromCache(String key)
     Get an object from the cache
Parameters:
  key - The key entered by the user.
public  ObjectgetFromCache(String key, int refreshPeriod)
     Get an object from the cache
Parameters:
  key - The key entered by the user.
Parameters:
  refreshPeriod - How long the object can stay in cache in seconds.
public  ObjectgetFromCache(String key, int refreshPeriod, String cronExpression)
     Get an object from the cache
Parameters:
  key - The key entered by the user.
Parameters:
  refreshPeriod - How long the object can stay in cache in seconds.
public  voidputInCache(String key, Object content, EntryRefreshPolicy policy)
    
public  voidputInCache(String key, Object content)
    
public  voidputInCache(String key, Object content, String[] groups)
    
public  voidputInCache(String key, Object content, String[] groups, EntryRefreshPolicy policy)
    
public  voidremoveEntry(String key)
    
public  voidsetCacheCapacity(int capacity)
     Sets the cache capacity (number of items).


Constructor Detail
GeneralCacheAdministrator
public GeneralCacheAdministrator()(Code)
Create the cache administrator.



GeneralCacheAdministrator
public GeneralCacheAdministrator(Properties p)(Code)
Create the cache administrator with the specified properties




Method Detail
cancelUpdate
public void cancelUpdate(String key)(Code)
Cancels a pending cache update. This should only be called by a thread that received a NeedsRefreshException and was unable to generate some new cache content.
Parameters:
  key - The cache entry key to cancel the update of.



destroy
public void destroy()(Code)
Shuts down the cache administrator.



flushAll
public void flushAll()(Code)
Flush the entire cache immediately.



flushAll
public void flushAll(Date date)(Code)
Flush the entire cache at the given date.
Parameters:
  date - The time to flush



flushEntry
public void flushEntry(String key)(Code)
Flushes a single cache entry.



flushGroup
public void flushGroup(String group)(Code)
Flushes all items that belong to the specified group.
Parameters:
  group - The name of the group to flush



flushPattern
public void flushPattern(String pattern)(Code)
Allows to flush all items that have a specified pattern in the key.
Parameters:
  pattern - Pattern.GeneralCacheAdministrator.flushGroup(String)



getCache
public Cache getCache()(Code)
Grabs a cache The cache



getFromCache
public Object getFromCache(String key) throws NeedsRefreshException(Code)
Get an object from the cache
Parameters:
  key - The key entered by the user. The object from cache
throws:
  NeedsRefreshException - when no cache entry could be found with thesupplied key, or when an entry was found but is considered out of date. Ifthe cache entry is a new entry that is currently being constructed this methodwill block until the new entry becomes available. Similarly, it will block ifa stale entry is currently being rebuilt by another thread and cache blocking isenabled (cache.blocking=true).



getFromCache
public Object getFromCache(String key, int refreshPeriod) throws NeedsRefreshException(Code)
Get an object from the cache
Parameters:
  key - The key entered by the user.
Parameters:
  refreshPeriod - How long the object can stay in cache in seconds. Toallow the entry to stay in the cache indefinitely, supply a value ofCacheEntry.INDEFINITE_EXPIRY The object from cache
throws:
  NeedsRefreshException - when no cache entry could be found with thesupplied key, or when an entry was found but is considered out of date. Ifthe cache entry is a new entry that is currently being constructed this methodwill block until the new entry becomes available. Similarly, it will block ifa stale entry is currently being rebuilt by another thread and cache blocking isenabled (cache.blocking=true).



getFromCache
public Object getFromCache(String key, int refreshPeriod, String cronExpression) throws NeedsRefreshException(Code)
Get an object from the cache
Parameters:
  key - The key entered by the user.
Parameters:
  refreshPeriod - How long the object can stay in cache in seconds. Toallow the entry to stay in the cache indefinitely, supply a value ofCacheEntry.INDEFINITE_EXPIRY
Parameters:
  cronExpression - A cron expression that the age of the cache entrywill be compared to. If the entry is older than the most recent match for thecron expression, the entry will be considered stale. The object from cache
throws:
  NeedsRefreshException - when no cache entry could be found with thesupplied key, or when an entry was found but is considered out of date. Ifthe cache entry is a new entry that is currently being constructed this methodwill block until the new entry becomes available. Similarly, it will block ifa stale entry is currently being rebuilt by another thread and cache blocking isenabled (cache.blocking=true).



putInCache
public void putInCache(String key, Object content, EntryRefreshPolicy policy)(Code)
Put an object in a cache
Parameters:
  key - The key entered by the user
Parameters:
  content - The object to store
Parameters:
  policy - Object that implements refresh policy logic



putInCache
public void putInCache(String key, Object content)(Code)
Put an object in a cache
Parameters:
  key - The key entered by the user
Parameters:
  content - The object to store



putInCache
public void putInCache(String key, Object content, String[] groups)(Code)
Puts an object in a cache
Parameters:
  key - The unique key for this cached object
Parameters:
  content - The object to store
Parameters:
  groups - The groups that this object belongs to



putInCache
public void putInCache(String key, Object content, String[] groups, EntryRefreshPolicy policy)(Code)
Puts an object in a cache
Parameters:
  key - The unique key for this cached object
Parameters:
  content - The object to store
Parameters:
  groups - The groups that this object belongs to
Parameters:
  policy - The refresh policy to use



removeEntry
public void removeEntry(String key)(Code)
Remove an object from the cache
Parameters:
  key - The key entered by the user.



setCacheCapacity
public void setCacheCapacity(int capacity)(Code)
Sets the cache capacity (number of items). If the cache contains more than capacity items then items will be removed to bring the cache back down to the new size.
Parameters:
  capacity - The new capacity of the cache



Fields inherited from com.opensymphony.oscache.base.AbstractCacheAdministrator
final public static String CACHE_ALGORITHM_KEY(Code)(Java Doc)
final public static String CACHE_BLOCKING_KEY(Code)(Java Doc)
final public static String CACHE_CAPACITY_KEY(Code)(Java Doc)
final public static String CACHE_DISK_UNLIMITED_KEY(Code)(Java Doc)
final public static String CACHE_ENTRY_EVENT_LISTENERS_KEY(Code)(Java Doc)
final public static String CACHE_MEMORY_KEY(Code)(Java Doc)
final public static String CACHE_PERSISTENCE_OVERFLOW_KEY(Code)(Java Doc)
final public static String PERSISTENCE_CLASS_KEY(Code)(Java Doc)
protected String algorithmClass(Code)(Java Doc)
protected int cacheCapacity(Code)(Java Doc)
protected Config config(Code)(Java Doc)
protected EventListenerList listenerList(Code)(Java Doc)

Methods inherited from com.opensymphony.oscache.base.AbstractCacheAdministrator
protected Cache configureStandardListeners(Cache cache)(Code)(Java Doc)
protected void finalizeListeners(Cache cache)(Code)(Java Doc)
protected CacheEventListener[] getCacheEventListeners()(Code)(Java Doc)
public String getProperty(String key)(Code)(Java Doc)
public boolean isBlocking()(Code)(Java Doc)
public boolean isMemoryCaching()(Code)(Java Doc)
public boolean isOverflowPersistence()(Code)(Java Doc)
public boolean isUnlimitedDiskCache()(Code)(Java Doc)
public void setAlgorithmClass(String newAlgorithmClass)(Code)(Java Doc)
protected void setCacheCapacity(int newCacheCapacity)(Code)(Java Doc)
public void setOverflowPersistence(boolean overflowPersistence)(Code)(Java Doc)
protected Cache setPersistenceListener(Cache cache)(Code)(Java Doc)

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 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.