Skip to content

why the 'RedisOperationsSessionRepository.RedisSession' is a inner class? #744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jintianxiayu opened this issue Mar 14, 2017 · 4 comments
Closed
Assignees
Labels
for: stack-overflow A question that's better suited to stackoverflow.com

Comments

@jintianxiayu
Copy link

why the 'RedisOperationsSessionRepository.RedisSession' is a inner class? as a resut I can not use the result of method:

public Map<String, RedisSession> findByIndexNameAndIndexValue(String indexName,
			String indexValue)
@vpavic vpavic self-assigned this Mar 14, 2017
@vpavic vpavic added the for: stack-overflow A question that's better suited to stackoverflow.com label Mar 14, 2017
@vpavic
Copy link
Contributor

vpavic commented Mar 14, 2017

RedisSession is an implementation of ExpiringSession that's specific to the RedisOperationsSessionRepository. That shouldn't prevent you from using
the FindByIndexNameSessionRepository.

Here's a usage example from find by username sample app guide:

@Autowired
FindByIndexNameSessionRepository<? extends ExpiringSession> sessions;

@RequestMapping("/")
public String index(Principal principal, Model model) {
    Collection<? extends ExpiringSession> usersSessions = this.sessions
            .findByIndexNameAndIndexValue(
                    FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME,
                    principal.getName())
            .values();
    model.addAttribute("sessions", usersSessions);
    return "index";
}

@vpavic
Copy link
Contributor

vpavic commented Mar 20, 2017

Closing as answered. If you have additional questions or feel that your original question isn't properly answered, please re-open the issue.

@vpavic vpavic closed this as completed Mar 20, 2017
@mrshawn191
Copy link

How would you approach this if you want to save/update session ??

@vpavic
Copy link
Contributor

vpavic commented Aug 14, 2018

See #849 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stack-overflow A question that's better suited to stackoverflow.com
Projects
None yet
Development

No branches or pull requests

3 participants