title: Magento 2 custom sessions not consistent
body: <p>I have created my own magento sessions using <a href="https://blog.e-zest.com/custom-sessions-in-magento-2" rel="nofollow noreferrer">this guide</a>, but the sessions are so fickle its driving me crazy!</p>
  
  <p>I have created a list of session functions so all session setters, getters and unsetters are using the session model.</p>
  
  <p>For example, there are plenty of functions like these in my <strong>app/code/MyModule/MySession/Model/Session.php</strong> file</p>
  
  <pre><code>//Set the car model from the session
  public function setSessionCarModel($value){
      return $this-&gt;_session-&gt;setCarModel($value);
  }
  
  //Get the car model from the session
  public function getSessionCarModel(){
      return $this-&gt;_session-&gt;getCarModel();
  }
  
  //Unset the car model from the session
  public function unsetSessionCarModel(){
      return $this-&gt;_session-&gt;unsCarModel();
  }
  </code></pre>
  
  <p>I am then trying to set, get and unset my sessions in multiple places across my site, a few examples are these (I know I shouldn't really be using the object manager in the .phtml files before it gets noted)</p>
  
  <p><strong>.phtml</strong></p>
  
  <pre><code>$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  $customSession = $objectManager-&gt;create('\MyModule\MySession\Model\Session');
  $carModel = $customSession-&gt;getSessionCarModel();
  </code></pre>
  
  <p><strong>Ajax file</strong></p>
  
  <pre><code>namespace MyVendor\MyModule\Controller\Ajax;
  
  use Magento\Framework\App\Action\Action;
  use Magento\Framework\App\Action\Context;
  use Magento\Framework\Controller\ResultFactory; 
  
  class Index extends Action {
      protected $_customSession;
  
      public function __construct(
          Context $context,
          \MyModule\MySession\Model\Session $customSession
      )
      {
          parent::__construct($context);
          $this-&gt;_customSession = $customSession;
      }
  
  
      public function execute(){
              $this-&gt;_customSession-&gt;setSessionCarModel(1);
      }
  }
  </code></pre>
  
  <p>And multiple other places across the site, but for some reason my sessions don't seem to be consistent, and its driving me insane!</p>
  
  <p>Sometimes it doesn't set them at all, sometimes it grabs old values, etc.</p>
  
  <p>Am I doing something wrong with the way i'm implementing custom sessions?</p>
  
  <p>If anyone could help shine a light on this i'd be very grateful!</p>
  
  <blockquote>
    <blockquote>
      <p>Magento Version - 2.3.2</p>
      
      <p>Session Store method - Files</p>
      
      <p>Mode - Development</p>
    </blockquote>
  </blockquote>