我在獨立環境中使用Spring3.1。在Spring中檢索緩存列表
我想緩存我的條目。 所以在3.1,我可以使用@Cacheable這樣:
@Cacheable("client")
@Override
public ClientDTO getClientByLogin(String login) throws FixException
{
ClientDTO client = null;
try
{
client = (ClientDTO) jdbcTemplate.queryForObject(GET_CLIENT_BY_LOGIN_STATEMENT, new Object[]
{ login }, new ClientDTO());
}
catch (EmptyResultDataAccessException e)
{
log.error("Client login not exist in database. login=" + login);
}
if (client == null)
{
throw new FixException("Return null from DB when executing getClientByLogin(), login=" + login);
}
return client;
}
現在我每次調用getClient一次先來看看在它的高速緩存respositry。
如果我想檢索緩存列表以迭代它。我怎麼做?
謝謝。
你說你想獲得所有緩存對象的列表,但你在這裏只是獲取單個對象... – kaqqao 2015-09-06 21:01:37