com.sapportals.wcm.protocol.webdav.cache

Class DiscardingCache

java.lang.Object
  extended by com.sapportals.wcm.protocol.webdav.cache.DiscardingCache
All Implemented Interfaces:
IDiscardable, IGenerationCache, ISimpleMap

public class DiscardingCache
extends Object
implements IGenerationCache, IDiscardable

DiscardingCache is a IGenerationCache for all kinds of Java objects.

DiscardingCache honors the IDiscardable interface. Objects placed in the cache will be checked for implementing IDiscardable before removing them from the cache.

DiscardingCache is multithread-safe.

Copyright (c) SAP AG 2001-2004


Constructor Summary
DiscardingCache(long generationTime)
          Construct a new Cache with the given time between generations
DiscardingCache(long generationTime, Map map1, Map map2)
          Construct a new Cache with the given time between generations and the given Maps for the two generations.
 
Method Summary
 void clear()
          Remove all entries from the cache
 void discard()
          This cache itself has been discarded.
 Object get(Object key)
          Retrieve the value for the given key
 long getGenerationTime()
           
 void put(Object key, Object value)
          Put the value in the cache under the given key
 void remove(Object key)
          Remove the given key and its value from the cache.
 void setGenerationTime(long generationTime)
          Adjust the generation time of this cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscardingCache

public DiscardingCache(long generationTime)
Construct a new Cache with the given time between generations

Parameters:
generationTime - time in milliseconds

DiscardingCache

public DiscardingCache(long generationTime,
                       Map map1,
                       Map map2)
Construct a new Cache with the given time between generations and the given Maps for the two generations. Both maps should be of the same type and size (if applicable).

Parameters:
generationTime - time in milliseconds
map1 - map for a generation
map2 - map for a generation
Method Detail

clear

public void clear()
Remove all entries from the cache

Specified by:
clear in interface ISimpleMap

discard

public void discard()
This cache itself has been discarded. Clear the cache.

Specified by:
discard in interface IDiscardable

get

public Object get(Object key)
Retrieve the value for the given key

Specified by:
get in interface ISimpleMap
Returns:
value for key or null

getGenerationTime

public long getGenerationTime()
Specified by:
getGenerationTime in interface IGenerationCache
Returns:
the generation time for this cache

put

public void put(Object key,
                Object value)
Put the value in the cache under the given key

Specified by:
put in interface ISimpleMap
Parameters:
key - for lookup of value
value - to place in cache

remove

public void remove(Object key)
Remove the given key and its value from the cache.

Specified by:
remove in interface ISimpleMap
Parameters:
key - the key which shall be removed

setGenerationTime

public void setGenerationTime(long generationTime)
Adjust the generation time of this cache.

Specified by:
setGenerationTime in interface IGenerationCache
Parameters:
generationTime - to set
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2012 SAP AG Complete Copyright Notice