HosipLan

Untitled

Apr 3rd, 2013
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. /**
  2.  * Třída existuje, aby se vůbec neukládala session, tam kde není potřeba.
  3.  * Například v API, nebo v Cronu se různě sahá na session, i když se reálně mezi requesty nepřenáší.
  4.  *
  5.  * @internal
  6.  */
  7. class ArraySessionStorage extends Nette\Object implements Nette\Http\ISessionStorage
  8. {
  9.  
  10.     /**
  11.      * @var array
  12.      */
  13.     private $session;
  14.  
  15.  
  16.  
  17.     public function open($savePath, $sessionName)
  18.     {
  19.         $this->session = array();
  20.     }
  21.  
  22.  
  23.  
  24.     public function close()
  25.     {
  26.         $this->session = array();
  27.     }
  28.  
  29.  
  30.  
  31.     public function read($id)
  32.     {
  33.         return isset($this->session[$id]) ? $this->session[$id] : NULL;
  34.     }
  35.  
  36.  
  37.  
  38.     public function write($id, $data)
  39.     {
  40.         $this->session[$id] = $data;
  41.     }
  42.  
  43.  
  44.  
  45.     public function remove($id)
  46.     {
  47.         unset($this->session[$id]);
  48.     }
  49.  
  50.  
  51.  
  52.     public function clean($maxlifetime)
  53.     {
  54.  
  55.     }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment