How to clear a session container in Zend framework2
You almost had it, you just need to pass the namespace to the clear method
$session_user->getManager()->getStorage()->clear('user');
You can still treat the $_SESSION like an array, too, so the following also works
unset($_SESSION['user']);
The Solution posted By @Crisp worked like a Charm But here is the alternative way what I found after a research to solve this problem
use Zend\Session\SessionManager;
$sessionManager = new SessionManager();
//get array of sessions from storage
$array_of_sessions = $sessionManager->getStorage();
//Unset which ever container you want by passing its name ( ZF1 its called namespace )
unset($array_of_sessions['user']);
unset($array_of_sessions['usershares']);
unset($array_of_sessions['actions']);
I feel session manager is the one that we need to use to manage sessions whether to clear or read and container is one of the entity which is managed by session manager .
This may help others who are possessive in creating objects of each session container and call clear method .