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/10/04 23:42:37 UTC

svn commit: r701715 - /wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java

Author: jcompagner
Date: Sat Oct  4 14:42:36 2008
New Revision: 701715

URL: http://svn.apache.org/viewvc?rev=701715&view=rev
Log:
from 1.3, cache implementations can use now a container to cache specific stuff

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java?rev=701715&r1=701714&r2=701715&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/MarkupCache.java Sat Oct  4 14:42:36 2008
@@ -347,7 +347,7 @@
 
 		// flag markup as non-existent
 		markupKeyCache.put(cacheKey, cacheKey);
-		return putIntoCache(cacheKey, Markup.NO_MARKUP);
+		return putIntoCache(cacheKey, container, Markup.NO_MARKUP);
 	}
 
 	/**
@@ -359,7 +359,10 @@
 	 * @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 {@link #putIntoCache(String, MarkupContainer, Markup)}
 	 */
+	@Deprecated
 	protected Markup putIntoCache(final String locationString, Markup markup)
 	{
 		if (locationString != null)
@@ -384,6 +387,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.
@@ -393,8 +417,7 @@
 	 * @param container
 	 * @return null, if not found or to enforce reloading the markup
 	 */
-	protected Markup getMarkupFromCache(final CharSequence cacheKey,
-		final MarkupContainer container)
+	protected Markup getMarkupFromCache(final CharSequence cacheKey, final MarkupContainer container)
 	{
 		if (cacheKey != null)
 		{
@@ -443,7 +466,7 @@
 				}
 				// add the markup to the cache.
 				markupKeyCache.put(cacheKey, locationString);
-				return putIntoCache(locationString, markup);
+				return putIntoCache(locationString, container, markup);
 			}
 			return markup;
 		}