ro.isdc.wro.cache.impl
Class LruMemoryCacheStrategy<K,V>

java.lang.Object
  extended by ro.isdc.wro.cache.impl.MemoryCacheStrategy<K,V>
      extended by ro.isdc.wro.cache.impl.LruMemoryCacheStrategy<K,V>
All Implemented Interfaces:
CacheStrategy<K,V>

public class LruMemoryCacheStrategy<K,V>
extends MemoryCacheStrategy<K,V>

This class implements a LRU (Least Recently Used) cache strategy. This cache must have a fixed-size. When new entries are added and the cache reach its maximum capacity, eldest entries are removed.

As all MemoryCacheStrategys this cache is thread-safe.

Since:
1.3.6
Author:
Matias Mirabelli <matias.mirabelli@globant.com>

Field Summary
static String ALIAS
          Aliased used by provider for this implementation
static int DEFAULT_SIZE
          Default cache size if no capacity is specified by the constructor.
 
Constructor Summary
LruMemoryCacheStrategy()
          Constructs a LruMemoryCacheStrategy and sets the default size up to DEFAULT_SIZE
LruMemoryCacheStrategy(int cacheSize)
          Constructs a new LruMemoryCacheStrategy and sets the cache size.
 
Method Summary
 
Methods inherited from class ro.isdc.wro.cache.impl.MemoryCacheStrategy
clear, destroy, get, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALIAS

public static final String ALIAS
Aliased used by provider for this implementation

See Also:
Constant Field Values

DEFAULT_SIZE

public static final int DEFAULT_SIZE
Default cache size if no capacity is specified by the constructor.

See Also:
Constant Field Values
Constructor Detail

LruMemoryCacheStrategy

public LruMemoryCacheStrategy()
Constructs a LruMemoryCacheStrategy and sets the default size up to DEFAULT_SIZE


LruMemoryCacheStrategy

public LruMemoryCacheStrategy(int cacheSize)
Constructs a new LruMemoryCacheStrategy and sets the cache size.

Parameters:
cacheSize - Cache size. It must be greater than 0.


Copyright © 2008-2013. All Rights Reserved.