public class ContentViewCache extends Object implements Serializable
Each content view instance will be cached if its cache key is not null. Each instance will be cached using the cache key so its state is restored. Also handles refresh of caches when receiving events configured on the content view.
Modifier and Type | Field and Description |
---|---|
protected Map<String,Map<String,ContentView>> |
cacheInstances |
static Integer |
DEFAULT_CACHE_SIZE
Default cache size, set to 5 instances per content view
|
protected Map<String,String> |
namedCacheKeys |
protected Map<String,ContentView> |
namedContentViews |
protected Map<String,Set<String>> |
refreshEventToContentViewName
Map holding content view names that need their page provider to be refreshed for a given event
|
protected Map<String,Set<String>> |
resetEventToContentViewName
Map holding content view names that need their page provider to be reset for a given event
|
Constructor and Description |
---|
ContentViewCache() |
Modifier and Type | Method and Description |
---|---|
void |
add(ContentView cView)
Add given content view to the cache, resolving its cache key and initializing it with its cache size.
|
ContentView |
get(String name)
Returns cached content view with given name, or null if not found.
|
void |
refresh(String contentViewName,
boolean rewind)
Refresh page providers for content views in the cache with given name.refreshEventToContentViewName
|
void |
refreshAll()
Iterates over all cached content view instances to refresh them.
|
protected void |
refreshAll(boolean rewind) |
void |
refreshAndRewindAll()
Iterates over all cached content view instances to refresh them.
|
void |
refreshOnEvent(String eventName)
Refresh page providers for content views having declared given event as a refresh event.
|
void |
reset(String contentViewName)
Resets all cached information for given content view.
|
void |
resetAll()
Resets all cached information for all content views, as well as configuration caches (refresh and reset events
linked to content views).
|
void |
resetAllContent()
Resets all cached information for all content views
|
void |
resetPageProvider(String contentViewName)
Resets page providers for content views in the cache with given name.
|
void |
resetPageProviderAggregates(String contentViewName)
Resets page providers aggregates.
|
void |
resetPageProviderOnEvent(String eventName)
Resets page providers for content views having declared given event as a reset event.
|
public static final Integer DEFAULT_CACHE_SIZE
protected final Map<String,String> namedCacheKeys
protected final Map<String,ContentView> namedContentViews
protected final Map<String,Map<String,ContentView>> cacheInstances
protected final Map<String,Set<String>> refreshEventToContentViewName
protected final Map<String,Set<String>> resetEventToContentViewName
public ContentViewCache()
public void add(ContentView cView)
Since 5.7, content views with a cache size <= 0 will be cached anyhow to handle selections, and rendering is in charge of forcing cache reset when re-displaying the page.
public ContentView get(String name)
public void refresh(String contentViewName, boolean rewind)
Other contextual information set on the content view and the page provider will be kept.
public void resetPageProvider(String contentViewName)
Other contextual information set on the content view will be kept.
public void resetPageProviderAggregates(String contentViewName)
public void refreshOnEvent(String eventName)
Other contextual information set on the content view and the page provider will be kept.
public void resetPageProviderOnEvent(String eventName)
Other contextual information set on the content view will be kept.
public void reset(String contentViewName)
public void resetAllContent()
public void resetAll()
public void refreshAll()
Can be costly if some page providers need to fetch content or perform costly operations at refresh.
public void refreshAndRewindAll()
Can be costly if some page providers need to fetch content or perform costly operations at refresh.
protected void refreshAll(boolean rewind)
Copyright © 2015 Nuxeo SA. All rights reserved.