|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.markup.MarkupCache
public class MarkupCache
This is Wicket's default IMarkupCache implementation. It will load the markup and cache it for fast retrieval.
If the application is in development mode and a markup file changes, it'll automatically be removed from the cache and reloaded when needed.
MarkupCache is registered with IMarkupSettings
and thus can be replaced with a subclassed
version.
IMarkupSettings
,
MarkupFactory
Nested Class Summary | |
---|---|
static class |
MarkupCache.DefaultCacheImplementation<K,V>
|
static interface |
MarkupCache.ICache<K,V>
MarkupCache allows you to implement you own cache implementation. |
Constructor Summary | |
---|---|
protected |
MarkupCache()
Constructor. |
Method Summary | ||
---|---|---|
void |
clear()
Clear markup cache and force reload of all markup data |
|
static IMarkupCache |
get()
A convenient helper to get the markup cache registered with the application. |
|
Markup |
getMarkup(MarkupContainer container,
Class<?> clazz,
boolean enforceReload)
THIS IS NOT PART OF WICKET'S PUBLIC API. |
|
protected MarkupCache.ICache<CharSequence,Markup> |
getMarkupCache()
Get a unmodifiable map which contains the cached data. |
|
IMarkupCacheKeyProvider |
getMarkupCacheKeyProvider(MarkupContainer container)
Get the markup cache key provider to be used |
|
protected Markup |
getMarkupFromCache(CharSequence cacheKey,
MarkupContainer container)
Wicket's default implementation just uses the cacheKey to retrieve the markup from the cache. |
|
protected
|
newCacheImplementation()
Allows you to change the map implementation which will hold the cache data. |
|
protected Markup |
onMarkupNotFound(String cacheKey,
MarkupContainer container)
Will be called if the markup was not in the cache yet but could not be found either. |
|
protected Markup |
putIntoCache(String locationString,
MarkupContainer container,
Markup markup)
Put the markup into the cache if cacheKey is not null and the cache does not yet contain the cacheKey. |
|
IMarkupFragment |
removeMarkup(String cacheKey)
Remove the markup associated with the cache key from the cache including all dependent markups (markup inheritance) |
|
void |
shutdown()
Will be called by the application while shutting down. |
|
int |
size()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected MarkupCache()
Method Detail |
---|
public static final IMarkupCache get()
Application
Application#getMarkupSettings()}
,
MarkupFactory#getMarkupCache()}
public void clear()
clear
in interface IMarkupCache
public void shutdown()
shutdown
in interface IMarkupCache
public final IMarkupFragment removeMarkup(String cacheKey)
removeMarkup
in interface IMarkupCache
MarkupResourceStream.getCacheKey()
public final int size()
size
in interface IMarkupCache
protected final MarkupCache.ICache<CharSequence,Markup> getMarkupCache()
public final Markup getMarkup(MarkupContainer container, Class<?> clazz, boolean enforceReload)
getMarkup
in interface IMarkupCache
container
- The original requesting markup containerclazz
- The class to get the associated markup for. If null, the container's class is
used, but it can be a parent class of the container as well (markup inheritance)enforceReload
- The cache will be ignored and all, including inherited markup files, will be
reloaded. Whatever is in the cache, it will be ignored
IMarkupCache.getMarkup(org.apache.wicket.MarkupContainer,
Class, boolean)
protected Markup onMarkupNotFound(String cacheKey, MarkupContainer container)
Subclasses may change the default implementation. E.g. they might choose not update the cache to enforce reloading of any markup not found. This might be useful in very dynamic environments.
cacheKey
- container
-
protected Markup putIntoCache(String locationString, MarkupContainer container, Markup markup)
locationString
- If null, than ignore the cachecontainer
- The container this markup is for.markup
-
protected Markup getMarkupFromCache(CharSequence cacheKey, MarkupContainer container)
cacheKey
- If null, than the cache will be ignoredcontainer
-
public IMarkupCacheKeyProvider getMarkupCacheKeyProvider(MarkupContainer container)
container
- The MarkupContainer requesting the markup resource stream
protected <K,V> MarkupCache.ICache<K,V> newCacheImplementation()
K
- V
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |