public class AccountCacheImpl extends java.lang.Object implements AccountCache
Modifier and Type | Method and Description |
---|---|
void |
evict(Account.Id accountId)
Evicts the account from the cache and triggers a reindex for it.
|
void |
evictAllNoReindex()
Evict all accounts from the cache, but doesn't trigger reindex of all accounts.
|
AccountState |
get(Account.Id accountId)
Returns an
AccountState instance for the given account ID. |
AccountState |
getByUsername(java.lang.String username)
Returns an
AccountState instance for the given username. |
AccountState |
getOrNull(Account.Id accountId)
Returns an
AccountState instance for the given account ID. |
static com.google.inject.Module |
module() |
public static com.google.inject.Module module()
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 getByUsername(java.lang.String username)
AccountCache
AccountState
instance for the given username.
This method first loads the external ID for the username and then uses the account ID of the external ID to lookup the account from the cache.
getByUsername
in interface AccountCache
username
- username of the account that should be retrievedAccountState
instance for the given username, if no account with this username
exists or if loading the external ID fails null
is returnedpublic void evict(Account.Id accountId) throws java.io.IOException
AccountCache
evict
in interface AccountCache
accountId
- account ID of the account that should be evictedjava.io.IOException
- thrown if reindexing failspublic void evictAllNoReindex()
AccountCache
evictAllNoReindex
in interface AccountCache