Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.javahispano.canyamo.util.cache
Class AbstractCache  view AbstractCache download AbstractCache.java

java.lang.Object
  extended byorg.javahispano.canyamo.util.cache.BasicAbstractCache
      extended byorg.javahispano.canyamo.util.cache.AbstractCache
All Implemented Interfaces:
Cache

public abstract class AbstractCache
extends BasicAbstractCache

Implementacion abstracta de una cahce a la que le falta el metodo que carga nuevos elementos.

Since:
Version:

Field Summary
protected  int cacheSize
          Description of the Field
protected  java.util.HashMap elements
          Elmentos en la cache
protected  java.util.List fifo
          Cola para indicar que elementos entran/salen del cache
 
Constructor Summary
AbstractCache(int size)
          Constructor for the UserCache object
 
Method Summary
 void add(java.lang.Object key, java.lang.Object element)
          Anyade el elemento dado a la cache con la clave dada.
 java.lang.Object get(java.lang.Object key)
          Devuelve el elemento referenciado de la cache.
abstract  java.lang.Object getData(java.lang.Object key)
          Metodo que se encargara de cargar el elemtno referenciado cuando no este en la cache
protected  void refreshCache(java.lang.Object key)
          Refresca el valor de la cahce, siguiendo un patron FIFO.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elements

protected java.util.HashMap elements
Elmentos en la cache


fifo

protected java.util.List fifo
Cola para indicar que elementos entran/salen del cache


cacheSize

protected int cacheSize
Description of the Field

Constructor Detail

AbstractCache

public AbstractCache(int size)
Constructor for the UserCache object

Since:
Method Detail

get

public java.lang.Object get(java.lang.Object key)
                     throws java.lang.Exception
Devuelve el elemento referenciado de la cache. Si no existe intentara cargarlo por medio del metodo abstracto getData que debera ser implementado.

Specified by:
get in interface Cache
Specified by:
get in class BasicAbstractCache
Since:

getData

public abstract java.lang.Object getData(java.lang.Object key)
                                  throws java.lang.Exception
Metodo que se encargara de cargar el elemtno referenciado cuando no este en la cache

Since:

add

public void add(java.lang.Object key,
                java.lang.Object element)
Anyade el elemento dado a la cache con la clave dada.

Specified by:
add in interface Cache
Since:

refreshCache

protected void refreshCache(java.lang.Object key)
Refresca el valor de la cahce, siguiendo un patron FIFO.
Esto significa que se eliminiran de la cache los elemetnos mas viejos.

Since: