public class AccountCacheImpl extends Object implements AccountCache
Modifier and Type | Method and Description |
---|---|
void |
evict(Account.Id accountId) |
void |
evictAll() |
void |
evictByUsername(String username) |
AccountState |
get(Account.Id accountId)
Returns an
AccountState instance for the given account ID. |
AccountState |
getByUsername(String username) |
AccountState |
getIfPresent(Account.Id accountId)
Returns an
AccountState instance for the given account ID if it is present in the
cache. |
AccountState |
getOrNull(Account.Id accountId)
Returns an
AccountState instance for the given account ID. |
static com.google.inject.Module |
module(boolean useReviewdb) |
public static com.google.inject.Module module(boolean useReviewdb)
public AccountState get(Account.Id accountId)
AccountCache
AccountState
instance for the given account ID. If not cached yet the
account is loaded. Returns an empty AccountState
instance to represent a missing
account.get
in interface AccountCache
accountId
- ID of the account that should be retrievedAccountState
instance for the given account ID, if no account with this ID
exists an empty AccountState
instance is returned to represent the missing accountpublic AccountState getOrNull(Account.Id accountId)
AccountCache
AccountState
instance for the given account ID. If not cached yet the
account is loaded. Returns null
if the account is missing.getOrNull
in interface AccountCache
accountId
- ID of the account that should be retrievedAccountState
instance for the given account ID, if no account with this ID
exists null
is returnedpublic AccountState getIfPresent(Account.Id accountId)
AccountCache
AccountState
instance for the given account ID if it is present in the
cache.getIfPresent
in interface AccountCache
accountId
- ID of the account that should be retrievedAccountState
instance for the given account ID if it is present in the cache,
otherwise null
public AccountState getByUsername(String username)
getByUsername
in interface AccountCache
public void evict(Account.Id accountId) throws IOException
evict
in interface AccountCache
IOException
public void evictAll() throws IOException
evictAll
in interface AccountCache
IOException
public void evictByUsername(String username)
evictByUsername
in interface AccountCache