com.groiss.ds
Class RingBuffer
java.lang.Object
com.groiss.ds.RingBuffer
public class RingBuffer
- extends java.lang.Object
ring buffer for caching the objects
the maximum size is provided by removing the oldest element
|
Constructor Summary |
RingBuffer(int size,
long timeout)
|
|
Method Summary |
void |
clear()
|
void |
emptyCache(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
|
java.lang.Object |
get(java.lang.String key)
return the bufferd element with the appropriate key;
null, if no element is bufferd with the key |
void |
put(java.lang.Object element,
java.lang.String key)
inserts an object into the ring buffer. |
void |
showBuffer(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RingBuffer
public RingBuffer(int size,
long timeout)
put
public void put(java.lang.Object element,
java.lang.String key)
- inserts an object into the ring buffer.
if the buffer is full, the oldest element is removed
oldest element: the element, that was referred by put() or get() the longest time ago
- Parameters:
element - an element to be cachedkey - the key for the cached element
get
public java.lang.Object get(java.lang.String key)
- return the bufferd element with the appropriate key;
null, if no element is bufferd with the key
clear
public void clear()
showBuffer
public void showBuffer(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.lang.Exception
- Throws:
java.lang.Exception
emptyCache
public void emptyCache(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
throws java.lang.Exception
- Throws:
java.lang.Exception
Copyright © 2001-2006 Groiss Informatics GmbH. All Rights Reserved.