org.specrunner.util.cache
Class CacheEntry<K,T>

java.lang.Object
  extended by org.specrunner.util.cache.CacheEntry<K,T>
Type Parameters:
K - Key type.
T - The object cache type.
All Implemented Interfaces:
Comparable<CacheEntry<K,T>>

public class CacheEntry<K,T>
extends Object
implements Comparable<CacheEntry<K,T>>

A cache entry.

Author:
Thiago Santos.

Constructor Summary
CacheEntry(K key, T value)
          Basic constructor.
 
Method Summary
 int compareTo(CacheEntry<K,T> o)
           
 boolean equals(Object obj)
           
 K getKey()
          Get the cache key.
 T getValue()
          Get the value.
 int hashCode()
           
 boolean invalid(long timeout)
          Based on timeout, says if an element must be removed from cache.
 void renew()
          Renew cache item timestamp.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheEntry

public CacheEntry(K key,
                  T value)
Basic constructor.

Parameters:
key - The key.
value - The value.
Method Detail

getKey

public K getKey()
Get the cache key.

Returns:
The key.

getValue

public T getValue()
Get the value.

Returns:
The value.

renew

public void renew()
Renew cache item timestamp.


invalid

public boolean invalid(long timeout)
Based on timeout, says if an element must be removed from cache.

Parameters:
timeout - The timeout.
Returns:
true, if out of date, true, otherwise.

compareTo

public int compareTo(CacheEntry<K,T> o)
Specified by:
compareTo in interface Comparable<CacheEntry<K,T>>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2014. All rights reserved.