com.openexchange.mail.cache
Class SessionMailCache

java.lang.Object
  extended by com.openexchange.mail.cache.SessionMailCache

public final class SessionMailCache
extends java.lang.Object

SessionMailCache - Several cacheable data bound to a user session.

Author:
Thorben Betten

Method Summary
 void clear()
          Clears all entries contained in cache.
static void clearAll(com.openexchange.session.Session session)
          Clears all user-related cached data.
<V> void
get(SessionMailCacheEntry<V> entry)
          Gets the entry acquired through SessionMailCacheEntry.getKey().
static SessionMailCache getInstance(com.openexchange.session.Session session, int accountId)
          Gets the session-bound mail cache.
<V> void
put(SessionMailCacheEntry<V> entry)
          Puts specified entry into cache if SessionMailCacheEntry.getValue() is not null.
<V> void
remove(SessionMailCacheEntry<V> entry)
          Removes the entry acquired through SessionMailCacheEntry.getKey() .
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SessionMailCache getInstance(com.openexchange.session.Session session,
                                           int accountId)
Gets the session-bound mail cache.

Parameters:
session - The session whose mail cache shall be returned
accountId - The account ID
Returns:
The session-bound mail cache.

clearAll

public static void clearAll(com.openexchange.session.Session session)
Clears all user-related cached data.


put

public <V> void put(SessionMailCacheEntry<V> entry)
Puts specified entry into cache if SessionMailCacheEntry.getValue() is not null. Otherwise the a possibly previously associated value with entry's key is removed from cache.

SessionMailCacheEntry.getKey() is used as key and SessionMailCacheEntry.getValue() as value.

Parameters:
entry - The mail cache entry

get

public <V> void get(SessionMailCacheEntry<V> entry)
Gets the entry acquired through SessionMailCacheEntry.getKey(). If present it's applied to entry via SessionMailCacheEntry.setValue(Object).

Type Parameters:
V - The cache entry's type
Parameters:
entry - The mail cache entry

remove

public <V> void remove(SessionMailCacheEntry<V> entry)
Removes the entry acquired through SessionMailCacheEntry.getKey() . If present it's applied to entry via SessionMailCacheEntry.setValue(Object).

Type Parameters:
V - The cache entry's type
Parameters:
entry - The mail cache entry

clear

public void clear()
Clears all entries contained in cache.