@Test public void findRolesByUsername() { final List<Roles> list = usersJdbcRepository.findRolesByUsername("abcd"); assertTrue(list.isEmpty()); }
@Override public List<Roles> findRolesByUsername(String username) { final Cache usersCache = getUsersCache(); final String key = generateUserRolesKey(username); @SuppressWarnings("unchecked") List<Roles> rolesList = (List<Roles>) getFromCache(usersCache, key); if (rolesList == null) { rolesList = usersRepository.findRolesByUsername(username); putToCache(usersCache, key, rolesList); LOG.debug("Load User roles[{}] from DB and cache it, key = {}", rolesList, key); } return rolesList; }
UsersRSRedisRepository extends AbstractCacheSupport implements UsersRepository { @Override public List<Roles> findRolesByUsername(String username) { final Cache usersCache = getUsersCache(); final String key = generateUserRolesKey(username); @SuppressWarnings("unchecked") List<Roles> rolesList = (List<Roles>) getFromCache(usersCache, key); if (rolesList == null) { rolesList = usersRepository.findRolesByUsername(username); putToCache(usersCache, key, rolesList); LOG.debug("Load User roles[{}] from DB and cache it, key = {}", rolesList, key); } return rolesList; } }
UsersRSRedisRepository extends AbstractCacheSupport implements UsersRepository { @Override public List<Roles> findRolesByUsername(String username) { final Cache usersCache = getUsersCache(); final String key = generateUserRolesKey(username); @SuppressWarnings("unchecked") List<Roles> rolesList = (List<Roles>) getFromCache(usersCache, key); if (rolesList == null) { rolesList = usersRepository.findRolesByUsername(username); putToCache(usersCache, key, rolesList); LOG.debug("Load User roles[{}] from DB and cache it, key = {}", rolesList, key); } return rolesList; }  }
UsersRSRedisRepository extends AbstractCacheSupport implements UsersRepository { @Override public List<Roles> findRolesByUsername(String username) { final Cache usersCache = getUsersCache(); final String key = generateUserRolesKey(username); @SuppressWarnings("unchecked") List<Roles> rolesList = (List<Roles>) getFromCache(usersCache, key); if (rolesList == null) { rolesList = usersRepository.findRolesByUsername(username); putToCache(usersCache, key, rolesList); LOG.debug("Load User roles[{}] from DB and cache it, key = {}", rolesList, key); } return rolesList; }  @Override Users findUsersByUsername(String username); @Override List<Roles> findRolesByUsername(String username); }
UsersRSRedisRepository extends AbstractCacheSupport implements UsersRepository { @Override public List<Roles> findRolesByUsername(String username) { final Cache usersCache = getUsersCache(); final String key = generateUserRolesKey(username); @SuppressWarnings("unchecked") List<Roles> rolesList = (List<Roles>) getFromCache(usersCache, key); if (rolesList == null) { rolesList = usersRepository.findRolesByUsername(username); putToCache(usersCache, key, rolesList); LOG.debug("Load User roles[{}] from DB and cache it, key = {}", rolesList, key); } return rolesList; }  @Override Users findUsersByUsername(String username); @Override List<Roles> findRolesByUsername(String username);  }