| java.lang.Object org.mmbase.cache.ReleaseStrategy
All known Subclasses: org.mmbase.cache.ChainedReleaseStrategy, org.mmbase.cache.BetterStrategy, org.mmbase.cache.BasicReleaseStrategy, org.mmbase.cache.ConstraintsMatchingStrategy,
ReleaseStrategy | abstract public class ReleaseStrategy (Code) | |
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.
author: Ernst Bunders since: MMBase-1.8 version: $Id: ReleaseStrategy.java,v 1.23 2007/02/24 21:57:51 nklasens Exp $ |
Inner Class :public static class StrategyResult | |
Inner Class :final protected static class Timer | |
Method Summary | |
public void | clear() | abstract protected boolean | doEvaluate(NodeEvent event, SearchQuery query, List<MMObjectNode> cachedResult) implement this method to create your own strategy. | abstract protected boolean | doEvaluate(RelationEvent event, SearchQuery query, List<MMObjectNode> cachedResult) implement this method to create your own strategy. | public boolean | equals(Object ob) | final public 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. | final public StrategyResult | evaluate(RelationEvent event, SearchQuery query, List<MMObjectNode> cachedResult) | public 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 public String | getDescription() | abstract public String | getName() | protected static List<SortOrder> | getSortordersForField(String fieldName, MMObjectBuilder builder, List<SortOrder> sortOrders, SearchQuery query) | public int | getTotalEvaluated() | public long | getTotalEvaluationTimeMillis() | public int | getTotalPreserved() | public int | hashCode() | public boolean | isEnabled() | public void | setEnabled(boolean newStatus) | public String | toString() |
ReleaseStrategy | public ReleaseStrategy()(Code) | | |
clear | public void clear()(Code) | | |
doEvaluate | abstract protected boolean doEvaluate(NodeEvent event, SearchQuery query, List<MMObjectNode> cachedResult)(Code) | | implement this method to create your own strategy.
Parameters: event - a node event Parameters: query - Parameters: cachedResult - true if the cache entry should be released |
doEvaluate | abstract protected boolean doEvaluate(RelationEvent event, SearchQuery query, List<MMObjectNode> cachedResult)(Code) | | implement this method to create your own strategy.
Parameters: event - a relation event Parameters: query - Parameters: cachedResult - true if the cache entry should be released |
getAvgEvaluationTimeInMilis | public int getAvgEvaluationTimeInMilis()(Code) | | |
getConstraintsForField | protected static List<Constraint> getConstraintsForField(String fieldName, MMObjectBuilder builder, Constraint constraint, SearchQuery query)(Code) | | 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. 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.
Parameters: fieldName - Parameters: builder - Parameters: constraint - Parameters: query - |
getTotalEvaluated | public int getTotalEvaluated()(Code) | | |
getTotalEvaluationTimeMillis | public long getTotalEvaluationTimeMillis()(Code) | | |
getTotalPreserved | public int getTotalPreserved()(Code) | | |
hashCode | public int hashCode()(Code) | | |
isEnabled | public boolean isEnabled()(Code) | | |
setEnabled | public void setEnabled(boolean newStatus)(Code) | | |
|
|