org.apache.mahout.cf.taste.impl.neighborhood
Class CachingUserNeighborhood

java.lang.Object
  extended by org.apache.mahout.cf.taste.impl.neighborhood.CachingUserNeighborhood
All Implemented Interfaces:
Refreshable, UserNeighborhood

public final class CachingUserNeighborhood
extends Object
implements UserNeighborhood

A caching wrapper around an underlying UserNeighborhood implementation.


Constructor Summary
CachingUserNeighborhood(UserNeighborhood neighborhood, DataModel dataModel)
           
 
Method Summary
 long[] getUserNeighborhood(long userID)
           
 void refresh(Collection<Refreshable> alreadyRefreshed)
           Triggers "refresh" -- whatever that means -- of the implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingUserNeighborhood

public CachingUserNeighborhood(UserNeighborhood neighborhood,
                               DataModel dataModel)
                        throws TasteException
Throws:
TasteException
Method Detail

getUserNeighborhood

public long[] getUserNeighborhood(long userID)
                           throws TasteException
Specified by:
getUserNeighborhood in interface UserNeighborhood
Parameters:
userID - ID of user for which a neighborhood will be computed
Returns:
IDs of users in the neighborhood
Throws:
TasteException - if an error occurs while accessing data

refresh

public void refresh(Collection<Refreshable> alreadyRefreshed)
Description copied from interface: Refreshable

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.

Specified by:
refresh in interface Refreshable
Parameters:
alreadyRefreshed - Refreshables that are known to have already been refreshed as a result of an initial call to a Refreshable.refresh(Collection) method on some object. This ensure that objects in a refresh dependency graph aren't refreshed twice needlessly.


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.