|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.planetj.taste.impl.recommender.CachingRecommender
public final class CachingRecommender
A Recommender which caches the results from another Recommender in memory.
Results are held by SoftReferences so that the JVM may reclaim memory from the recommendationCache
in low-memory situations.
| Constructor Summary | |
|---|---|
CachingRecommender(Recommender recommender)
|
|
| Method Summary | |
|---|---|
void |
clear()
Clears all cached recommendations. |
void |
clear(java.lang.Object userID)
Clears cached recommendations for the given user. |
double |
estimatePreference(java.lang.Object userID,
java.lang.Object itemID)
|
DataModel |
getDataModel()
|
java.util.List<RecommendedItem> |
recommend(java.lang.Object userID,
int howMany)
|
java.util.List<RecommendedItem> |
recommend(java.lang.Object userID,
int howMany,
Rescorer<Item> rescorer)
|
void |
refresh()
Triggers "refresh" -- whatever that means -- of the implementation. |
void |
removePreference(java.lang.Object userID,
java.lang.Object itemID)
|
void |
setPreference(java.lang.Object userID,
java.lang.Object itemID,
double value)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CachingRecommender(Recommender recommender)
throws TasteException
TasteException| Method Detail |
|---|
@NotNull
public java.util.List<RecommendedItem> recommend(java.lang.Object userID,
int howMany)
throws TasteException
recommend in interface RecommenderuserID - user for which recommendations are to be computedhowMany - desired number of recommendations
List of recommended RecommendedItems, ordered from most strongly
recommend to least
TasteException - if an error occurs while accessing the DataModel
@NotNull
public java.util.List<RecommendedItem> recommend(java.lang.Object userID,
int howMany,
Rescorer<Item> rescorer)
throws TasteException
recommend in interface RecommenderuserID - user for which recommendations are to be computedhowMany - desired number of recommendationsrescorer - rescoring function to apply before final list of recommendations is determined
List of recommended RecommendedItems, ordered from most strongly
recommend to least
TasteException - if an error occurs while accessing the DataModel
public double estimatePreference(java.lang.Object userID,
java.lang.Object itemID)
throws TasteException
estimatePreference in interface RecommenderuserID - user ID whose preference is to be estimateditemID - item ID to estimate preference for
Double.NaN
TasteException - if an error occurs while accessing the DataModel
public void setPreference(java.lang.Object userID,
java.lang.Object itemID,
double value)
throws TasteException
setPreference in interface RecommenderuserID - user to set preference foritemID - item to set preference forvalue - preference value
TasteException - if an error occurs while accessing the DataModel
public void removePreference(java.lang.Object userID,
java.lang.Object itemID)
throws TasteException
removePreference in interface RecommenderuserID - user from which to remove preferenceitemID - item for which to remove preference
TasteException - if an error occurs while accessing the DataModel@NotNull public DataModel getDataModel()
getDataModel in interface RecommenderDataModel used by this Recommenderpublic void refresh()
Triggers "refresh" -- whatever that means -- of the implementation. The general contract is that
any Refreshable should always leave itself in a consistent, operational state, and that
the refresh atomically updates internal state from old to new.
refresh in interface Refreshablepublic void clear(java.lang.Object userID)
Clears cached recommendations for the given user.
userID - clear cached data associated with this user IDpublic void clear()
Clears all cached recommendations.
@NotNull public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||