Results 1 to 3 of 3

Thread: Retrieve caching list

  1. #1

    Default Retrieve caching list

    I am using Spring3.1 in standalone Env.

    I am trying to cache my entries. So in 3.1 I can use @Cacheable this way

    Code:
    @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;
    }

    now each time i invoke getClientByLoginit will look first in it's cache respositry.

    If I want to retrieve the current caching list of client in order to iterate on it. How i do it?

    thanks.

  2. #2

    Default

    What cache implementation are you using?

    Can you query the client cache within the cache manager?

    Jeff

  3. #3

    Default

    I am using ehcache.

    But I found the solution:

    Code:
    EhCacheCache clientCache = null;
    		
    			clientCache = (EhCacheCache) ehCacheCacheManager.getCache("client");

    thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •