Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.slide.util
Class HashMapObjectCache

    java.lang.Object
      org.apache.slide.util.AbstractObjectCache
          org.apache.slide.util.HashMapObjectCache

All Implemented Interfaces:
  ObjectCache

Deprecated. The cache may grew beyond max size or not cache not at all. see Bug 13142

public class HashMapObjectCache
extends AbstractObjectCache

Object cache implementation using Keith Visco's HashMap structure.

Version:
  $Revision: 1.11 $ $Date: 2004/07/28 09:34:29 $

Field Summary
`protected HashMap` | `cache` Deprecated. Cache structure.

Fields inherited from class org.apache.slide.util.AbstractObjectCache
`cacheHits, cacheRequests, currentHitRatio, DEFAULT_HIT_RATIO, DEFAULT_SIZE, desiredHitRatio, initialSize, maxSize`

Constructor Summary
`HashMapObjectCache()` Deprecated. Constructor.
`HashMapObjectCache(int initialSize, int maxSize, double desiredHitRatio)` Deprecated. Constructor.

Method Summary
`void` | `clear()` Deprecated. Clear object cache.
`java.lang.Object` | `get(java.lang.Object key)` Deprecated. Get the object associated with the key.
`protected int` | `getSize()` Deprecated. Get cache size.
`void` | `put(java.lang.Object key, java.lang.Object value)` Deprecated. Add an object to the cache, or overwrite its value.
`void` | `remove(java.lang.Object key)` Deprecated. Remove object associated with the given key.
`protected void` | `removeSomeObjects()` Deprecated. Removes some elements from the cache.
`protected void` | `resize()` Deprecated. Resize cache.

Methods inherited from class org.apache.slide.util.AbstractObjectCache
`shouldResize`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### cache

    protected HashMap cache

  Deprecated.
  Cache structure.

Constructor Detail

### HashMapObjectCache

    public HashMapObjectCache()

  Deprecated.
  Constructor.

  Warning (blinking) : That constructor is to be used really carefully as the cache maximum size is not limited.

### HashMapObjectCache

    public HashMapObjectCache(int initialSize,
                              int maxSize,
                              double desiredHitRatio)

  Deprecated.
  Constructor.

Parameters:
  `initialSize` - Initial size of the cache
  `maxSize` - Maximum size of the cache
  `desiredHitRatio` - Desired cache hit ratio

Method Detail

### get

    public java.lang.Object get(java.lang.Object key)

  Deprecated.
  Get the object associated with the key.

  Specified by:
    `get` in interface `ObjectCache`
  Specified by:
    `get` in class `AbstractObjectCache`
  Parameters:
    `key` - Object's key
  Returns:
    Object null if there is no object associated with that key in the cache, or the object value otherwise

### put

    public void put(java.lang.Object key,
                    java.lang.Object value)

  Deprecated.
  Add an object to the cache, or overwrite its value.

  Specified by:
    `put` in interface `ObjectCache`
  Specified by:
    `put` in class `AbstractObjectCache`
  Parameters:
    `key` - Object's key
    `value` - Object's value

### remove

    public void remove(java.lang.Object key)

  Deprecated.
  Remove object associated with the given key. Doesn't do anything if the key wasn't associated with any object.

  Specified by:
    `remove` in interface `ObjectCache`
  Specified by:
    `remove` in class `AbstractObjectCache`
  Parameters:
    `key` - Object's key

### clear

    public void clear()

  Deprecated.
  Clear object cache.

  Specified by:
    `clear` in interface `ObjectCache`
  Specified by:
    `clear` in class `AbstractObjectCache`

### removeSomeObjects

    protected void removeSomeObjects()

  Deprecated.
  Removes some elements from the cache. The selection of the objects to remove, along with the number are left to the implementation.

  Specified by:
    `removeSomeObjects` in class `AbstractObjectCache`

### getSize

    protected int getSize()

  Deprecated.
  Get cache size.

  Specified by:
    `getSize` in class `AbstractObjectCache`
  Returns:
    int Current cache size

### resize

    protected void resize()

  Deprecated.
  Resize cache.

  Specified by:
    `resize` in class `AbstractObjectCache`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD