Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Session / SaveHandler / Cache.php
blob871807fe9de4fbe4ee5ad2a5672bf5bbc8345852
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Session\SaveHandler;
12 use Zend\Cache\Storage\ClearExpiredInterface as ClearExpiredCacheStorage;
13 use Zend\Cache\Storage\StorageInterface as CacheStorage;
15 /**
16 * Cache session save handler
18 class Cache implements SaveHandlerInterface
20 /**
21 * Session Save Path
23 * @var string
25 protected $sessionSavePath;
27 /**
28 * Session Name
30 * @var string
32 protected $sessionName;
34 /**
35 * The cache storage
36 * @var CacheStorage
38 protected $cacheStorage;
40 /**
41 * Constructor
43 * @param CacheStorage $cacheStorage
45 public function __construct(CacheStorage $cacheStorage)
47 $this->setCacheStorage($cacheStorage);
50 /**
51 * Open Session
53 * @param string $savePath
54 * @param string $name
55 * @return bool
57 public function open($savePath, $name)
59 // @todo figure out if we want to use these
60 $this->sessionSavePath = $savePath;
61 $this->sessionName = $name;
63 return true;
66 /**
67 * Close session
69 * @return bool
71 public function close()
73 return true;
76 /**
77 * Read session data
79 * @param string $id
80 * @return string
82 public function read($id)
84 return $this->getCacheStorage()->getItem($id);
87 /**
88 * Write session data
90 * @param string $id
91 * @param string $data
92 * @return bool
94 public function write($id, $data)
96 return $this->getCacheStorage()->setItem($id, $data);
99 /**
100 * Destroy session
102 * @param string $id
103 * @return bool
105 public function destroy($id)
107 return $this->getCacheStorage()->removeItem($id);
111 * Garbage Collection
113 * @param int $maxlifetime
114 * @return bool
116 public function gc($maxlifetime)
118 $cache = $this->getCacheStorage();
119 if ($cache instanceof ClearExpiredCacheStorage) {
120 return $cache->clearExpired();
122 return true;
126 * Set cache storage
128 * @param CacheStorage $cacheStorage
129 * @return Cache
131 public function setCacheStorage(CacheStorage $cacheStorage)
133 $this->cacheStorage = $cacheStorage;
134 return $this;
138 * Get cache storage
140 * @return CacheStorage
142 public function getCacheStorage()
144 return $this->cacheStorage;
148 * @deprecated Misspelled method - use getCacheStorage() instead
150 public function getCacheStorge()
152 return $this->getCacheStorage();