title: Spring Boot session management - combined solution PostgreSQL + Redis
body: <p>So, I would like to implement complex session management in my application. Essentially, I would like to store user sessions both in the postgre and Redis.</p>
  <p>So, the algorithm should be the following:</p>
  <ol>
  <li><p>A request is sent to the app, the application parses incoming request cookies and extracts a session parameter;</p>
  </li>
  <li><p>Spring server tries to retrieve respective session object by id from Redis</p>
  </li>
  </ol>
  <ul>
  <li>If the previous step succeeds, then the server verifies the session and lets the request pass through if the session is active and valid. Otherwise - unauthorized path.</li>
  </ul>
  <ol start="3">
  <li>If the session object isn't present in the Redis, then the server tries pulling a member session from the postgre. Does the same verifications and caches the response. If the session isn't valid or isn't present in RDBMS - go to the unauthorized path.</li>
  </ol>
  <p>Is there any elegant way to implement the following mechanism using existing packages? Or will this require custom logic?</p>