freemarker.cache

Class SoftCacheStorage

Implemented Interfaces:
CacheStorage, ConcurrentCacheStorage

public class SoftCacheStorage
extends java.lang.Object
implements ConcurrentCacheStorage

Soft cache storage is a cache storage that uses SoftReference objects to hold the objects it was passed, therefore allows the garbage collector to purge the cache when it determines that it wants to free up memory. This class is thread-safe to the extent that its underlying map is. The default implementation uses a concurrent map on Java 5 and above, so it is thread-safe in that case.
Version:
$Id: SoftCacheStorage.java,v 1.4 2003/09/22 20:47:03 ddekany Exp $
Author:
Attila Szegedi

Constructor Summary

SoftCacheStorage()
SoftCacheStorage(Map backingMap)

Method Summary

void
clear()
Object
get(Object key)
boolean
isConcurrent()
void
put(Object key, Object value)
void
remove(Object key)

Constructor Details

SoftCacheStorage

public SoftCacheStorage()

SoftCacheStorage

public SoftCacheStorage(Map backingMap)

Method Details

clear

public void clear()
Specified by:
clear in interface CacheStorage

get

public Object get(Object key)
Specified by:
get in interface CacheStorage

isConcurrent

public boolean isConcurrent()
Specified by:
isConcurrent in interface ConcurrentCacheStorage

put

public void put(Object key,
                Object value)
Specified by:
put in interface CacheStorage

remove

public void remove(Object key)
Specified by:
remove in interface CacheStorage