Included is a patch that provides lateral caches with removeonputmode. When this mode is enabled in the cache.ccf file for a particular lateral cache, changes to a cached object will result in the other caches dumping their cached object and requiring them to reload the object if they need it. Combined this mode with putonlymode, and then objects will never be streamed across the wire, only their keys.
Please note: In order to complete the implementation, code that called into jcs to add items into the cache must know whether the item being cached was just loaded (i.e. from the database so it is 'pure') or was previously cached and was modified. It is necessary to know this distinction otherwise only a single server in an app server farm would hold onto the object being cached. So I changed our jcs code to clear the IS_LATERAL flag in the IElementAttributes implementation when an object was 'new' or just loaded from the database. Since we are using torque, I changed the AbstractBaseManager.java file that houses the implementation of the CacheAccess.put command.
Also, I have changed the logging of socket error handling in LateralCacheManager.java. Only in debug logging mode will the stack crawl of a failure in calling the LateralTCPService be shown. This was necessary for us in that if a server is not available, we don't need a huge message in our logs. The standard message shows the server, port and error.
Index: src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
===================================================================
RCS file: /usr/local/cvsrep/javatools/jakarta/jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java 21 Mar 2003 18:28:54 -0000 1.1.1.1
+++ src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java 2 Apr 2003 19:21:48 -0000 1.2
@@ -94,7 +94,14 @@
"LateralCacheInfo.listenerId = " +
LateralCacheInfo.listenerId );
}
- lateral.update( ce, LateralCacheInfo.listenerId );
+ if ( cattr.getRemoveOnPutMode() )
+ {
+ lateral.remove(ce.getCacheName(),ce.getKey());
+ }
+ else
+ {
+ lateral.update( ce, LateralCacheInfo.listenerId );
+ }
}
catch ( NullPointerException npe )
{
Index: src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java
===================================================================
RCS file: /usr/local/cvsrep/javatools/jakarta/jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java 21 Mar 2003 18:28:54 -0000 1.1.1.1
+++ src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java 2 Apr 2003 19:21:48 -0000 1.2
@@ -44,6 +44,7 @@
private String name;
boolean putOnlyMode = true;
+ boolean removeOnPutMode = false;
/**
* Sets the httpServer attribute of the LateralCacheAttributes object
@@ -385,6 +386,27 @@
public boolean getPutOnlyMode()
{
return putOnlyMode;
+ }
+
+ /**
+ * Sets the RemoveOnPut attribute of the ILateralCacheAttributes. When
+ * this is true the lateral cache will issue a remove request to the other
+ * lateral cache servers when an update is issued.
+ *
+ *
+ * @param val The new transmissionTypeName value
+ */
+ public void setRemoveOnPutMode( boolean val )
+ {
+ this.removeOnPutMode = val;
+ }
+
+ /**
+ * @return The removeOnPut value. Stops puts from broadcasting objects to pulled in by other servers
+ */
+ public boolean getRemoveOnPutMode()
+ {
+ return removeOnPutMode;
}
Index: src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java
===================================================================
RCS file: /usr/local/cvsrep/javatools/jakarta/jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java 21 Mar 2003 18:28:54 -0000 1.1.1.1
+++ src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java 2 Apr 2003 19:21:48 -0000 1.2
@@ -143,7 +143,8 @@
// Configure this LateralCacheManager instance to use the
// "zombie" services.
- log.error( "Failure, lateral instance will use zombie service", ex );
+ log.error( "Failure, lateral instance will use zombie service (set logging to debug to see stack trace)" );
+ log.debug( "Stack crawl of failure", ex );
lateralService = new ZombieLateralCacheService();
lateralWatch = new LateralCacheWatchRepairable();
Index: src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
===================================================================
RCS file: /usr/local/cvsrep/javatools/jakarta/jcs/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java 21 Mar 2003 18:28:54 -0000 1.1.1.1
+++ src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java 2 Apr 2003 19:21:48 -0000 1.2
@@ -197,4 +197,18 @@
*/
public boolean getPutOnlyMode();
+ /**
+ * Sets the removeOnPutMode attribute of the ILateralCacheAttributes. When this
+ * is true the lateral cache will remove items when an update is requested
+ *
+ * @param val The new transmissionTypeName value
+ */
+ public void setRemoveOnPutMode( boolean val );
+
+
+ /**
+ * @return The removeOnPutMode value. Stops puts from broadcasting objects
+ */
+ public boolean getRemoveOnPutMode();
+
}
<<removeonputmode.txt>>
Index: src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java
===================================================================
RCS file:
/usr/local/cvsrep/javatools/jakarta/jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java 21 Mar 2003 18:28:54
-0000 1.1.1.1
+++ src/java/org/apache/jcs/auxiliary/lateral/LateralCache.java 2 Apr 2003 19:21:48
-0000 1.2
@@ -94,7 +94,14 @@
"LateralCacheInfo.listenerId = " +
LateralCacheInfo.listenerId );
}
- lateral.update( ce, LateralCacheInfo.listenerId );
+ if ( cattr.getRemoveOnPutMode() )
+ {
+ lateral.remove(ce.getCacheName(),ce.getKey());
+ }
+ else
+ {
+ lateral.update( ce, LateralCacheInfo.listenerId );
+ }
}
catch ( NullPointerException npe )
{
Index: src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java
===================================================================
RCS file:
/usr/local/cvsrep/javatools/jakarta/jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java 21 Mar
2003 18:28:54 -0000 1.1.1.1
+++ src/java/org/apache/jcs/auxiliary/lateral/LateralCacheAttributes.java 2 Apr
2003 19:21:48 -0000 1.2
@@ -44,6 +44,7 @@
private String name;
boolean putOnlyMode = true;
+ boolean removeOnPutMode = false;
/**
* Sets the httpServer attribute of the LateralCacheAttributes object
@@ -385,6 +386,27 @@
public boolean getPutOnlyMode()
{
return putOnlyMode;
+ }
+
+ /**
+ * Sets the RemoveOnPut attribute of the ILateralCacheAttributes. When
+ * this is true the lateral cache will issue a remove request to the other
+ * lateral cache servers when an update is issued.
+ *
+ *
+ * @param val The new transmissionTypeName value
+ */
+ public void setRemoveOnPutMode( boolean val )
+ {
+ this.removeOnPutMode = val;
+ }
+
+ /**
+ * @return The removeOnPut value. Stops puts from broadcasting objects to pulled
in by other servers
+ */
+ public boolean getRemoveOnPutMode()
+ {
+ return removeOnPutMode;
}
Index: src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java
===================================================================
RCS file:
/usr/local/cvsrep/javatools/jakarta/jcs/src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java 21 Mar 2003
18:28:54 -0000 1.1.1.1
+++ src/java/org/apache/jcs/auxiliary/lateral/LateralCacheManager.java 2 Apr 2003
19:21:48 -0000 1.2
@@ -143,7 +143,8 @@
// Configure this LateralCacheManager instance to use the
// "zombie" services.
- log.error( "Failure, lateral instance will use zombie service", ex );
+ log.error( "Failure, lateral instance will use zombie service (set
logging to debug to see stack trace)" );
+ log.debug( "Stack crawl of failure", ex );
lateralService = new ZombieLateralCacheService();
lateralWatch = new LateralCacheWatchRepairable();
Index: src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
===================================================================
RCS file:
/usr/local/cvsrep/javatools/jakarta/jcs/src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
21 Mar 2003 18:28:54 -0000 1.1.1.1
+++ src/java/org/apache/jcs/auxiliary/lateral/behavior/ILateralCacheAttributes.java
2 Apr 2003 19:21:48 -0000 1.2
@@ -197,4 +197,18 @@
*/
public boolean getPutOnlyMode();
+ /**
+ * Sets the removeOnPutMode attribute of the ILateralCacheAttributes. When this
+ * is true the lateral cache will remove items when an update is requested
+ *
+ * @param val The new transmissionTypeName value
+ */
+ public void setRemoveOnPutMode( boolean val );
+
+
+ /**
+ * @return The removeOnPutMode value. Stops puts from broadcasting objects
+ */
+ public boolean getRemoveOnPutMode();
+
}--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
