|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.mmbase.cache.ReleaseStrategy
public abstract class ReleaseStrategy
This class is the base for all cache release strategies. You should extend this to create your own. It will contain a number of usefull utility methods to analyze query objecs and cached search results. Feel free to add those In case you miss one developing your own strategies.
| Nested Class Summary | |
|---|---|
static class |
ReleaseStrategy.StrategyResult
|
| Constructor Summary | |
|---|---|
ReleaseStrategy()
|
|
| Method Summary | |
|---|---|
void |
clear()
|
protected abstract boolean |
doEvaluate(NodeEvent event,
SearchQuery query,
List<MMObjectNode> cachedResult)
implement this method to create your own strategy. |
protected abstract boolean |
doEvaluate(RelationEvent event,
SearchQuery query,
List<MMObjectNode> cachedResult)
implement this method to create your own strategy. |
boolean |
equals(Object ob)
|
ReleaseStrategy.StrategyResult |
evaluate(NodeEvent event,
SearchQuery query,
List<MMObjectNode> cachedResult)
This method checks if evaluation should happen (active), keeps the time of the operation and updates the statistics. |
ReleaseStrategy.StrategyResult |
evaluate(RelationEvent event,
SearchQuery query,
List<MMObjectNode> cachedResult)
|
int |
getAvgEvaluationTimeInMilis()
|
protected static List<Constraint> |
getConstraintsForField(String fieldName,
MMObjectBuilder builder,
Constraint constraint,
SearchQuery query)
utility for specializations: get all the constraints in the query that apply to a certain field TODO MM: This method is used like this: if(getConstraintsForField(fieldName, eventBuilder, constraint, query).size() > 0){ return false;}
IOW, only the size of the return list is used, and then even whether it is 0 or not. |
abstract String |
getDescription()
|
abstract String |
getName()
|
protected static List<SortOrder> |
getSortordersForField(String fieldName,
MMObjectBuilder builder,
List<SortOrder> sortOrders,
SearchQuery query)
utility for specializations: get all the sortorders in the query that apply to a certain field TODO MM: See remark at getConstraintsForField(java.lang.String, org.mmbase.module.core.MMObjectBuilder, org.mmbase.storage.search.Constraint, org.mmbase.storage.search.SearchQuery) |
int |
getTotalEvaluated()
|
long |
getTotalEvaluationTimeMillis()
|
int |
getTotalPreserved()
|
int |
hashCode()
|
boolean |
isEnabled()
|
void |
setEnabled(boolean newStatus)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ReleaseStrategy()
| Method Detail |
|---|
public abstract String getName()
public abstract String getDescription()
public int getAvgEvaluationTimeInMilis()
public long getTotalEvaluationTimeMillis()
public final ReleaseStrategy.StrategyResult evaluate(NodeEvent event,
SearchQuery query,
List<MMObjectNode> cachedResult)
doEvaluate(NodeEvent event, SearchQuery query, List cachedResult).
public final ReleaseStrategy.StrategyResult evaluate(RelationEvent event,
SearchQuery query,
List<MMObjectNode> cachedResult)
public int getTotalPreserved()
public int getTotalEvaluated()
protected abstract boolean doEvaluate(NodeEvent event,
SearchQuery query,
List<MMObjectNode> cachedResult)
event - a node eventquery - cachedResult -
protected abstract boolean doEvaluate(RelationEvent event,
SearchQuery query,
List<MMObjectNode> cachedResult)
event - a relation eventquery - cachedResult -
public void setEnabled(boolean newStatus)
public boolean isEnabled()
public void clear()
public boolean equals(Object ob)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
protected static List<Constraint> getConstraintsForField(String fieldName,
MMObjectBuilder builder,
Constraint constraint,
SearchQuery query)
if(getConstraintsForField(fieldName, eventBuilder, constraint, query).size() > 0){ return false;}
IOW, only the size of the return list is used, and then even whether it is 0 or not. I think it is a waste to construct a complete new list, only for that.
Perhaps the method should return an Iterator?, and can be used with only 'hasNext()', constructing a longer list then necessary is avoided then.
fieldName - builder - constraint - query -
protected static List<SortOrder> getSortordersForField(String fieldName,
MMObjectBuilder builder,
List<SortOrder> sortOrders,
SearchQuery query)
getConstraintsForField(java.lang.String, org.mmbase.module.core.MMObjectBuilder, org.mmbase.storage.search.Constraint, org.mmbase.storage.search.SearchQuery)
fieldName - builder - sortOrders - query -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||