org.ozoneDB.core.storage
Class FixedSizeDelayCache
java.lang.Object
org.ozoneDB.core.storage.AbstractTrimmingCache
org.ozoneDB.core.storage.DelayCache
org.ozoneDB.core.storage.FixedSizeDelayCache
- All Implemented Interfaces:
- Cache, PropertyConfigurable, TrimmingCache
- public class FixedSizeDelayCache
- extends DelayCache
A cache with a fixed maximum number of objects in it. This cache grows
until it has reached its maximum, which can be set by maxCapacity. Once that
maximum has been reached, the least recently used object is thrown away when
a new object is put in the cache. This cache has, next to that maximum number
of elements, also a maximum time an element will remain in this cache. If
that time has expired the element will be removed from this cache also.
Reinserting an element (using the same key) causes the time for that element
to be reset.
Note: every instance creates its own thread for asynchronous removal of
items past their 'best before' time. The trimmed() method on the TrimHandler
is often but not always called asynchronously from that thread.
- Version:
- $Id: FixedSizeDelayCache.java,v 1.1.2.2 2004/04/10 10:06:51 per_nyfelt Exp $
- Author:
- Leo Mekenkamp (mind the anti sp@m)
Constructor Summary |
FixedSizeDelayCache(java.util.Properties properties,
java.lang.String prefix)
|
Method Summary |
int |
getMaxCapacity()
|
java.util.Collection |
getPropertyInfos()
Returns a Collection with all the properties this instance
supports. |
private void |
ourTrim()
|
void |
put(java.lang.Object key,
java.lang.Object value)
Puts an object into the cache, along with its identifying key. |
void |
setMaxCapacity(int maxCapacity)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static final java.util.logging.Logger log
MAXCAPACITY
public static final PropertyInfo MAXCAPACITY
maxCapacity
private int maxCapacity
FixedSizeDelayCache
public FixedSizeDelayCache(java.util.Properties properties,
java.lang.String prefix)
setMaxCapacity
public final void setMaxCapacity(int maxCapacity)
getMaxCapacity
public final int getMaxCapacity()
getPropertyInfos
public java.util.Collection getPropertyInfos()
- Description copied from interface:
PropertyConfigurable
Returns a Collection
with all the properties this instance
supports.
- Specified by:
getPropertyInfos
in interface PropertyConfigurable
- Overrides:
getPropertyInfos
in class DelayCache
put
public void put(java.lang.Object key,
java.lang.Object value)
- Description copied from interface:
Cache
- Puts an object into the cache, along with its identifying key.
- Specified by:
put
in interface Cache
- Overrides:
put
in class DelayCache
ourTrim
private void ourTrim()
Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.