org.apache.mahout.common.cache
Class LeastKCache<K extends java.lang.Comparable<? super K>,V>

java.lang.Object
  extended by org.apache.mahout.common.cache.LeastKCache<K,V>
All Implemented Interfaces:
Cache<K,V>

public class LeastKCache<K extends java.lang.Comparable<? super K>,V>
extends java.lang.Object
implements Cache<K,V>


Constructor Summary
LeastKCache(int capacity)
           
 
Method Summary
 long capacity()
          returns the total capacity of the cache defined at contruction time
 boolean contains(K key)
          returns true if the Cache contains the key
 V get(K key)
          Gets the Value from the Cache, If the object doesnt exist default behaviour is to return null.
 void set(K key, V value)
          puts the key and its value into the cache
 long size()
          returns the current size of the cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeastKCache

public LeastKCache(int capacity)
Method Detail

capacity

public final long capacity()
Description copied from interface: Cache
returns the total capacity of the cache defined at contruction time

Specified by:
capacity in interface Cache<K extends java.lang.Comparable<? super K>,V>
Returns:
long

get

public final V get(K key)
Description copied from interface: Cache
Gets the Value from the Cache, If the object doesnt exist default behaviour is to return null.

Specified by:
get in interface Cache<K extends java.lang.Comparable<? super K>,V>
Returns:
V

set

public final void set(K key,
                      V value)
Description copied from interface: Cache
puts the key and its value into the cache

Specified by:
set in interface Cache<K extends java.lang.Comparable<? super K>,V>

size

public final long size()
Description copied from interface: Cache
returns the current size of the cache

Specified by:
size in interface Cache<K extends java.lang.Comparable<? super K>,V>
Returns:
long

contains

public final boolean contains(K key)
Description copied from interface: Cache
returns true if the Cache contains the key

Specified by:
contains in interface Cache<K extends java.lang.Comparable<? super K>,V>
Returns:
boolean


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.