You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2008/08/19 22:28:06 UTC

svn commit: r687145 - /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java

Author: jcompagner
Date: Tue Aug 19 13:28:05 2008
New Revision: 687145

URL: http://svn.apache.org/viewvc?rev=687145&view=rev
Log:
some api upgrades so that caching can be better done differently if somebody wants it 

Modified:
    wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java

Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java?rev=687145&r1=687144&r2=687145&view=diff
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java (original)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java Tue Aug 19 13:28:05 2008
@@ -346,7 +346,7 @@
 		}
 
 		// flag markup as non-existent
-		return putIntoCache(cacheKey, Markup.NO_MARKUP);
+		return putIntoCache(cacheKey, container, Markup.NO_MARKUP);
 	}
 
 	/**
@@ -358,6 +358,8 @@
 	 * @param markup
 	 * @return markup The markup provided, except if the cacheKey already existed in the cache, than
 	 *         the markup from the cache is provided.
+	 * 
+	 * @deprecated see
 	 */
 	protected Markup putIntoCache(final String locationString, Markup markup)
 	{
@@ -383,6 +385,27 @@
 	}
 
 	/**
+	 * Put the markup into the cache if cacheKey is not null and the cache does not yet contain the
+	 * cacheKey. Return the markup stored in the cache if cacheKey is present already.
+	 * 
+	 * More sophisticated implementations may call a container method to e.g. cache it per container
+	 * instance.
+	 * 
+	 * @param locationString
+	 *            If null, than ignore the cache
+	 * @param container
+	 *            The container this markup is for.
+	 * @param markup
+	 * @return markup The markup provided, except if the cacheKey already existed in the cache, than
+	 *         the markup from the cache is provided.
+	 */
+	protected Markup putIntoCache(final String locationString, MarkupContainer container,
+		Markup markup)
+	{
+		return putIntoCache(locationString, markup);
+	}
+
+	/**
 	 * Wicket's default implementation just uses the cacheKey to retrieve the markup from the cache.
 	 * More sophisticated implementations may call a container method to e.g. ignore the cached
 	 * markup under certain situations.
@@ -435,12 +458,13 @@
 
 			if (cacheKey != null)
 			{
-				if (markup.locationAsString() != null) {
+				if (markup.locationAsString() != null)
+				{
 					locationString = markup.locationAsString();
 				}
 				// add the markup to the cache.
 				markupKeyCache.put(cacheKey, locationString);
-				return putIntoCache(locationString, markup);
+				return putIntoCache(locationString, container, markup);
 			}
 			return markup;
 		}