biz.hammurapi.cache
Class SimpleMemoryCache

java.lang.Object
  extended by biz.hammurapi.cache.AbstractProducer
      extended by biz.hammurapi.cache.SimpleMemoryCache
All Implemented Interfaces:
Cache, Producer, Component

public class SimpleMemoryCache
extends AbstractProducer
implements Cache

Simple cache. Uses map internally.

Version:
$Revision: 1.3 $
Author:
Pavel Vlasov

Constructor Summary
SimpleMemoryCache(Producer producer)
           
 
Method Summary
 void clear()
          Removes all cache entries
 Entry get(java.lang.Object key)
           
 boolean isActive()
           
 java.util.Set keySet()
           
 void put(java.lang.Object key, java.lang.Object value, long time, long expirationTime)
          Puts entry to cache
 void remove(Acceptor acceptor)
          Removes keys accepted by acceptor
 void remove(java.lang.Object key)
          Removes entry with specified key
 void setOwner(java.lang.Object owner)
          Plugs the component into container and naming bus.
 void start()
          Invoked by container before the first use.
 void stop()
          Invoked by container when component is not needed anymore.
 
Methods inherited from class biz.hammurapi.cache.AbstractProducer
addCache, onRemove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface biz.hammurapi.cache.Producer
addCache
 

Constructor Detail

SimpleMemoryCache

public SimpleMemoryCache(Producer producer)
Method Detail

put

public void put(java.lang.Object key,
                java.lang.Object value,
                long time,
                long expirationTime)
Description copied from interface: Cache
Puts entry to cache

Specified by:
put in interface Cache
Parameters:
key - Key
value - Value
time - Timestamp (last modified)
expirationTime - Expiration time

get

public Entry get(java.lang.Object key)
Specified by:
get in interface Producer

clear

public void clear()
Description copied from interface: Cache
Removes all cache entries

Specified by:
clear in interface Cache

remove

public void remove(java.lang.Object key)
Description copied from interface: Cache
Removes entry with specified key

Specified by:
remove in interface Cache

remove

public void remove(Acceptor acceptor)
Description copied from interface: Cache
Removes keys accepted by acceptor

Specified by:
remove in interface Cache

stop

public void stop()
Description copied from interface: Component
Invoked by container when component is not needed anymore. Component shall perform cleanup in this method.

Specified by:
stop in interface Component

keySet

public java.util.Set keySet()
Specified by:
keySet in interface Producer
Returns:
all keys, null or empty collection if entire key set is not known

isActive

public boolean isActive()
Specified by:
isActive in interface Cache
Returns:
true if not shut down

start

public void start()
           throws ConfigurationException
Description copied from interface: Component
Invoked by container before the first use. Component shall perform initialization in this method.

Specified by:
start in interface Component
Throws:
ConfigurationException

setOwner

public void setOwner(java.lang.Object owner)
Description copied from interface: Component
Plugs the component into container and naming bus.

Specified by:
setOwner in interface Component


Copyright © 2003 Hammurapi Group. All Rights Reserved.