APIdia Launch Partner
Top Inners Fields Constructors Methods
sun.security.util

pack-priv Class MemoryCache<K, V>

Located in compilation unit of sun.security.util.Cache.

extends Cache<K, V>
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
private static class
private static class
MemoryCache.QueueCacheEntry<K, V>

This CacheEntry<k,v> type allows multiple V entries to be stored in one key in the cacheMap.

private static class

Field Summary

Modifier and TypeField and Description
private final Map<K, MemoryCache.CacheEntry<K, V>>
private static final boolean
private long
private final int
private int
private long
private final ReferenceQueue<V>

Constructor Summary

AccessConstructor and Description
public
MemoryCache(boolean soft, int maxSize)

public
MemoryCache(boolean soft, int maxSize, int lifetime)

public
MemoryCache(boolean soft, int maxSize, int lifetime, int qSize)

Method Summary

Modifier and TypeMethod and Description
public synchronized void
accept(Cache.CacheVisitor<K, V> visitor)

Implements abstract sun.security.util.Cache.accept.

accept a visitor

public synchronized void
clear()

Implements abstract sun.security.util.Cache.clear.

Remove all entries from the cache.

private void
emptyQueue()

Empty the reference queue and remove all corresponding entries from the cache.

private void
expungeExpiredEntries()

Scan all entries and remove all expired ones.

public synchronized V
get(Object key)

Implements abstract sun.security.util.Cache.get.

Get a value from the cache.

private Map<K, V>
protected MemoryCache.CacheEntry<K, V>
newEntry(K key, V value, long expirationTime, ReferenceQueue<V> queue)

public synchronized V
pull(Object key)

Implements abstract sun.security.util.Cache.pull.

Pull an entry from the cache.

public void
put(K key, V value)

Implements abstract sun.security.util.Cache.put.

Add an entry to the cache.

public synchronized void
put(K
key to the cacheMap
key
,
V
value to be stored
value
,
boolean
can the value be put into a QueueCacheEntry
canQueue
)

Overrides sun.security.util.Cache.put.

This puts an entry into the cacheMap.

public synchronized void
remove(Object key)

Implements abstract sun.security.util.Cache.remove.

Remove an entry from the cache.

private void
public synchronized void
setCapacity(int size)

Implements abstract sun.security.util.Cache.setCapacity.

Set the maximum size.

public synchronized void
setTimeout(int timeout)

Implements abstract sun.security.util.Cache.setTimeout.

Set the timeout(in seconds).

public synchronized int
size()

Implements abstract sun.security.util.Cache.size.

Return the number of currently valid entries in the cache.

Inherited from sun.security.util.Cache:
newHardMemoryCachenewHardMemoryCachenewNullCachenewSoftMemoryCachenewSoftMemoryCachenewSoftMemoryQueue

Field Detail

cacheMapback to summary
private final Map<K, MemoryCache.CacheEntry<K, V>> cacheMap
DEBUGback to summary
private static final boolean DEBUG
lifetimeback to summary
private long lifetime
maxQueueSizeback to summary
private final int maxQueueSize
maxSizeback to summary
private int maxSize
nextExpirationTimeback to summary
private long nextExpirationTime
queueback to summary
private final ReferenceQueue<V> queue

Constructor Detail

MemoryCacheback to summary
public MemoryCache(boolean soft, int maxSize)
MemoryCacheback to summary
public MemoryCache(boolean soft, int maxSize, int lifetime)
MemoryCacheback to summary
public MemoryCache(boolean soft, int maxSize, int lifetime, int qSize)

Method Detail

acceptback to summary
public synchronized void accept(Cache.CacheVisitor<K, V> visitor)

Implements abstract sun.security.util.Cache.accept.

Doc from sun.security.util.Cache.accept.

accept a visitor

clearback to summary
public synchronized void clear()

Implements abstract sun.security.util.Cache.clear.

Doc from sun.security.util.Cache.clear.

Remove all entries from the cache.

emptyQueueback to summary
private void emptyQueue()

Empty the reference queue and remove all corresponding entries from the cache. This method should be called at the beginning of each public method.

expungeExpiredEntriesback to summary
private void expungeExpiredEntries()

Scan all entries and remove all expired ones.

getback to summary
public synchronized V get(Object key)

Implements abstract sun.security.util.Cache.get.

Doc from sun.security.util.Cache.get.

Get a value from the cache.

getCachedEntriesback to summary
private Map<K, V> getCachedEntries()
newEntryback to summary
protected MemoryCache.CacheEntry<K, V> newEntry(K key, V value, long expirationTime, ReferenceQueue<V> queue)
pullback to summary
public synchronized V pull(Object key)

Implements abstract sun.security.util.Cache.pull.

Doc from sun.security.util.Cache.pull.

Pull an entry from the cache.

putback to summary
public void put(K key, V value)

Implements abstract sun.security.util.Cache.put.

Doc from sun.security.util.Cache.put.

Add an entry to the cache.

putback to summary
public synchronized void put(K key, V value, boolean canQueue)

Overrides sun.security.util.Cache.put.

This puts an entry into the cacheMap. If canQueue is true, V will be added using a QueueCacheEntry which is added to cacheMap. If false, V is added to the cacheMap directly. The caller must keep a consistent canQueue value, mixing them can result in a queue being replaced with a single entry. This method is synchronized to avoid multiple QueueCacheEntry overwriting the same key.

Parameters
key:K

key to the cacheMap

value:V

value to be stored

canQueue:boolean

can the value be put into a QueueCacheEntry

removeback to summary
public synchronized void remove(Object key)

Implements abstract sun.security.util.Cache.remove.

Doc from sun.security.util.Cache.remove.

Remove an entry from the cache.

removeImplback to summary
private void removeImpl(Object key)
setCapacityback to summary
public synchronized void setCapacity(int size)

Implements abstract sun.security.util.Cache.setCapacity.

Doc from sun.security.util.Cache.setCapacity.

Set the maximum size.

setTimeoutback to summary
public synchronized void setTimeout(int timeout)

Implements abstract sun.security.util.Cache.setTimeout.

Doc from sun.security.util.Cache.setTimeout.

Set the timeout(in seconds).

sizeback to summary
public synchronized int size()

Implements abstract sun.security.util.Cache.size.

Doc from sun.security.util.Cache.size.

Return the number of currently valid entries in the cache.

sun.security.util back to summary

private Interface MemoryCache.CacheEntry<K, V>

Known Direct Implementers
sun.security.util.MemoryCache.HardCacheEntry, sun.security.util.MemoryCache.SoftCacheEntry, sun.security.util.MemoryCache.QueueCacheEntry

Method Summary

Modifier and TypeMethod and Description
public long
public K
public V
public void
public boolean
isValid(long currentTime)

Method Detail

getExpirationTimeback to summary
public long getExpirationTime()
getKeyback to summary
public K getKey()
getValueback to summary
public V getValue()
invalidateback to summary
public void invalidate()
isValidback to summary
public boolean isValid(long currentTime)
sun.security.util back to summary

private Class MemoryCache.HardCacheEntry<K, V>

extends Object
implements MemoryCache.CacheEntry<K, V>
Class Inheritance
All Implemented Interfaces
sun.security.util.MemoryCache.CacheEntry

Field Summary

Modifier and TypeField and Description
private long
private K
private V

Constructor Summary

AccessConstructor and Description
pack-priv
HardCacheEntry(K key, V value, long expirationTime)

Method Summary

Modifier and TypeMethod and Description
public long
public K
public V
public void
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

expirationTimeback to summary
private long expirationTime
keyback to summary
private K key
valueback to summary
private V value

Constructor Detail

HardCacheEntryback to summary
pack-priv HardCacheEntry(K key, V value, long expirationTime)

Method Detail

getExpirationTimeback to summary
public long getExpirationTime()

Implements sun.security.util.MemoryCache.CacheEntry.getExpirationTime.

getKeyback to summary
public K getKey()

Implements sun.security.util.MemoryCache.CacheEntry.getKey.

getValueback to summary
public V getValue()

Implements sun.security.util.MemoryCache.CacheEntry.getValue.

invalidateback to summary
public void invalidate()

Implements sun.security.util.MemoryCache.CacheEntry.invalidate.

isValidback to summary
public boolean isValid(long currentTime)

Implements sun.security.util.MemoryCache.CacheEntry.isValid.

sun.security.util back to summary

private Class MemoryCache.QueueCacheEntry<K, V>

extends Object
implements MemoryCache.CacheEntry<K, V>
Class Inheritance
All Implemented Interfaces
sun.security.util.MemoryCache.CacheEntry

This CacheEntry type allows multiple V entries to be stored in one key in the cacheMap. This implementation is need for TLS clients that receive multiple PSKs or NewSessionTickets for server resumption.

Field Summary

Modifier and TypeField and Description
pack-priv final boolean
private long
private K
private final int
pack-priv final Queue<MemoryCache.CacheEntry<K, V>>

Constructor Summary

AccessConstructor and Description
pack-priv
QueueCacheEntry(K key, MemoryCache.CacheEntry<K, V> entry, long expirationTime, int maxSize)

Method Summary

Modifier and TypeMethod and Description
public void
public long
public K
public Queue<MemoryCache.CacheEntry<K, V>>
public V
public V
getValue(long lifetime)

public void
public boolean
public boolean
public boolean
public void
public void
setExpirationTime(long time)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEBUGback to summary
pack-priv final boolean DEBUG
expirationTimeback to summary
private long expirationTime
keyback to summary
private K key
MAXQUEUESIZEback to summary
private final int MAXQUEUESIZE
queueback to summary
pack-priv final Queue<MemoryCache.CacheEntry<K, V>> queue

Constructor Detail

QueueCacheEntryback to summary
pack-priv QueueCacheEntry(K key, MemoryCache.CacheEntry<K, V> entry, long expirationTime, int maxSize)

Method Detail

clearback to summary
public void clear()
getExpirationTimeback to summary
public long getExpirationTime()

Implements sun.security.util.MemoryCache.CacheEntry.getExpirationTime.

getKeyback to summary
public K getKey()

Implements sun.security.util.MemoryCache.CacheEntry.getKey.

getQueueback to summary
public Queue<MemoryCache.CacheEntry<K, V>> getQueue()
getValueback to summary
public V getValue()

Implements sun.security.util.MemoryCache.CacheEntry.getValue.

getValueback to summary
public V getValue(long lifetime)
invalidateback to summary
public void invalidate()

Implements sun.security.util.MemoryCache.CacheEntry.invalidate.

isEmptyback to summary
public boolean isEmpty()
isValidback to summary
public boolean isValid(long currentTime)

Implements sun.security.util.MemoryCache.CacheEntry.isValid.

isValidback to summary
public boolean isValid()
putValueback to summary
public void putValue(MemoryCache.CacheEntry<K, V> entry)
setExpirationTimeback to summary
public void setExpirationTime(long time)
sun.security.util back to summary

private Class MemoryCache.SoftCacheEntry<K, V>

extends SoftReference<V>
implements MemoryCache.CacheEntry<K, V>
Class Inheritance
All Implemented Interfaces
sun.security.util.MemoryCache.CacheEntry

Field Summary

Modifier and TypeField and Description
private long
private K

Constructor Summary

AccessConstructor and Description
pack-priv
SoftCacheEntry(K key, V value, long expirationTime, ReferenceQueue<V> queue)

Method Summary

Modifier and TypeMethod and Description
public long
public K
public V
public void
public boolean
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.ref.SoftReference:
get

Field Detail

expirationTimeback to summary
private long expirationTime
keyback to summary
private K key

Constructor Detail

SoftCacheEntryback to summary
pack-priv SoftCacheEntry(K key, V value, long expirationTime, ReferenceQueue<V> queue)

Method Detail

getExpirationTimeback to summary
public long getExpirationTime()

Implements sun.security.util.MemoryCache.CacheEntry.getExpirationTime.

getKeyback to summary
public K getKey()

Implements sun.security.util.MemoryCache.CacheEntry.getKey.

getValueback to summary
public V getValue()

Implements sun.security.util.MemoryCache.CacheEntry.getValue.

invalidateback to summary
public void invalidate()

Implements sun.security.util.MemoryCache.CacheEntry.invalidate.

isValidback to summary
public boolean isValid(long currentTime)

Implements sun.security.util.MemoryCache.CacheEntry.isValid.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override