org.apache.mahout.common.cache
Class HybridCache<K,V>

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

public class HybridCache<K,V>
extends java.lang.Object
implements Cache<K,V>


Constructor Summary
HybridCache(int lfuCapacity, int lruCapacity)
           
 
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

HybridCache

public HybridCache(int lfuCapacity,
                   int lruCapacity)
Method Detail

capacity

public 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,V>
Returns:
long

get

public 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,V>
Returns:
V

set

public 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,V>

size

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

Specified by:
size in interface Cache<K,V>
Returns:
long

contains

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

Specified by:
contains in interface Cache<K,V>
Returns:
boolean


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