BEA Systems, Inc.

WebLogic Server 8.1 API Reference

weblogic.security.acl
Class TTLCache

java.lang.Object
  |
  +--weblogic.security.acl.TTLCache

Deprecated. Deprecated in WebLogic Server 7.0.

public class TTLCache
extends java.lang.Object

Fixed-size pseudo-LRU cache with per-entry TTL attributes. This cache maps keys to values in the usual way, and associates a time-to-live (TTL) value with each map entry.

If the cache is full when an insertion is performed, an approximation to the least-recently-used (LRU) entry is evicted to make room for the new entry.

Entries that become stale, because they have exceeded their tiem-to-live values, are removed from the cache.

Keys are considered immutable; if you change a key after adding it to a cache, the mapping will be lost.

Author:
Copyright © 2004 BEA Systems, Inc. All Rights Reserved.

Constructor Summary
TTLCache(int buckets, int capacity, long ttl)
          Deprecated. Construct a new cache.
TTLCache(int buckets, long ttl)
          Deprecated. Construct a new cache.
 
Method Summary
 void cleanup()
          Deprecated. Force the cache to be cleaned.
 void clear()
          Deprecated. Clear the cache.
 boolean containsKey(java.lang.Object key)
          Deprecated.  
 java.lang.Object get(java.lang.Object key)
          Deprecated. Return the value associated with the given key, or null if none.
 weblogic.logging.LogOutputStream getDebugLog()
          Deprecated.  
 double getHitRate()
          Deprecated. The hit rate for lookups performed since this cache was constructed or last cleared.
 int getInsertions()
          Deprecated. The number of insertions performed since this cache was constructed or last cleared.
 int getLookups()
          Deprecated. The number of lookups performed since this cache was constructed or last cleared.
 double getLRUEvictionRate()
          Deprecated. The LRU eviction rate for insertions performed since this cache was constructed or last cleared.
 double getStaleEvictionRate()
          Deprecated. The stale eviction rate for insertions performed since this cache was constructed or last cleared.
 boolean isEmpty()
          Deprecated. Indicate whether this table is empty.
 java.lang.Object put(java.lang.Object keyValue)
          Deprecated. Insert a new entry into the cache.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Deprecated. Insert a new entry into the cache.
 java.lang.Object remove(java.lang.Object key)
          Deprecated. Remove the mapping for the given key from the cache.
 void setDebugLog(weblogic.logging.LogOutputStream debug)
          Deprecated.  
 int size()
          Deprecated. Return an approximate indication of the size of this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TTLCache

public TTLCache(int buckets,
                long ttl)
Deprecated. 
Construct a new cache. The number of buckets must be specified; the overall capacity will be six times the number of buckets. Each entry will live no longer than ttl milliseconds.

For best performance, the number of the buckets should be prime.

Parameters:
buckets - number of buckets
ttl - time-to-live for entries, in milliseconds

TTLCache

public TTLCache(int buckets,
                int capacity,
                long ttl)
Deprecated. 
Construct a new cache. The number of buckets must be specified, as must the overall capacity (which must be greater than the number of buckets). Each entry will live no longer than ttl milliseconds.

For best performance, the number of buckets should be prime, and the capacity of the cache should be roughly a small multiple (between 4 and 10) of the number of buckets.

Parameters:
buckets - number of buckets
capacity - capacity of the cache
ttl - time-to-live for entries, in milliseconds
Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Deprecated. 
Insert a new entry into the cache. If another value was already present for the same key in the map, the old value may (but is not guaranteed) be returned.

Parameters:
key - (may not be null)
value - (may not be null)
Returns:
previous value for the given key, if found

put

public java.lang.Object put(java.lang.Object keyValue)
Deprecated. 
Insert a new entry into the cache. This entry maps the key to itself. If another value was already present for the same key in the map, the old value may (but is not guaranteed) be returned.

Parameters:
keyValue - key and value (may not be null)
Returns:
previous value for the given key, if found

get

public java.lang.Object get(java.lang.Object key)
Deprecated. 
Return the value associated with the given key, or null if none.

Returns:
value, or null

remove

public java.lang.Object remove(java.lang.Object key)
Deprecated. 
Remove the mapping for the given key from the cache. If the mapping existed and was not stale, its old value is returned, otherwise null.

Parameters:
key - the key of the mapping to remove
Returns:
old value

clear

public void clear()
Deprecated. 
Clear the cache. All statistics are also reset.

cleanup

public void cleanup()
Deprecated. 
Force the cache to be cleaned. This forcibly evicts any stale entries that have not yet been automatically cleaned out.

size

public int size()
Deprecated. 
Return an approximate indication of the size of this table. This value will include any stale entries in the table, and so may not be accurate.

isEmpty

public boolean isEmpty()
Deprecated. 
Indicate whether this table is empty.

containsKey

public boolean containsKey(java.lang.Object key)
Deprecated. 

setDebugLog

public void setDebugLog(weblogic.logging.LogOutputStream debug)
Deprecated. 

getDebugLog

public weblogic.logging.LogOutputStream getDebugLog()
Deprecated. 

getLookups

public int getLookups()
Deprecated. 
The number of lookups performed since this cache was constructed or last cleared.

getHitRate

public double getHitRate()
Deprecated. 
The hit rate for lookups performed since this cache was constructed or last cleared. This is a value between 0 and 1; higher values are better. If your hit rate seems too low, try raising your TTL or changing your cache size.

If this method is called before any lookups have been performed, a divide-by-zero exception will result.


getInsertions

public int getInsertions()
Deprecated. 
The number of insertions performed since this cache was constructed or last cleared. This does not have any correspondence to the number of entries currently in the cache.

getStaleEvictionRate

public double getStaleEvictionRate()
Deprecated. 
The stale eviction rate for insertions performed since this cache was constructed or last cleared. This is a value between 0 and 1. A stale eviction indicates that an existing entry was evicted from the cache either because its TTL expired. A high stale eviction rate is not necessarily bad.

If this method is called before any lookups have been performed, a divide-by-zero exception will result.


getLRUEvictionRate

public double getLRUEvictionRate()
Deprecated. 
The LRU eviction rate for insertions performed since this cache was constructed or last cleared. This is a value between 0 and 1. An LRU eviction indicates that an existing entry was evicted from the cache because the cache was full. A high LRU eviction rate indicates that the cache size should be increased.

If this method is called before any lookups have been performed, a divide-by-zero exception will result.


Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs81