pow
pow copied to clipboard
Refactor cache logic
Initial work towards a refactor of cache logic
The first step was to move invalidation of existing active sessions to the Pow.Plug.Session module. It doesn't seem right that Pow.Store.CredentialsCache should know about :fingerprint.
Next steps:
- [ ] Add logic to invalidate all sessions for user (resolves #404)
- [ ] Update cache to prevent N+1 and other performance issues in #562:
- [ ] Can fetch multiple records at once
- [ ] Can delete multiple records at once
- [ ] Explore message passing logic to notify processes of session expiration (#122 #492)
Before using erlang match spec, the keys where just binary name spaced values. It was necessary to create three records to pull in all sessions for a user or all users for the sessions. With the match spec I believe that it might be possible to change Pow.Store.CredentialsCache to only use one query to fetch session, sessions for a user, and users for all sessions.