text changes to registration mail content
[namibia] / module / Utility / src / Utility / Doctrine / ZendShmCache.php
1 <?php
2
3 namespace Doctrine\Common\Cache;
4
5
6 /**
7  * ZendServer SHM cache provider.
8  * @author Andre Fourie
9  */
10 class ZendShmCache extends \Doctrine\Common\Cache\CacheProvider
11 {
12
13         protected $cache = null;
14
15         public function __construct()
16         {
17                 $this->cache = new \Memcache();
18                 $this->cache->pconnect('localhost', 11211);
19         }
20
21         /**
22          * {@inheritdoc}
23          */
24         protected function doFetch($id)
25         {
26                 return $this->cache->get(APP_KEY . '.DOC2::' . $id);
27         }
28
29         /**
30          * {@inheritdoc}
31          */
32         protected function doContains($id)
33         {
34                 return (bool) $this->cache->get(APP_KEY . '.DOC2::' . $id);
35         }
36
37         /**
38          * {@inheritdoc}
39          */
40         protected function doSave($id, $data, $lifeTime = 0)
41         {
42                 if ($lifeTime > 30 * 24 * 3600) {
43                         $lifeTime = time() + $lifeTime;
44                 }
45                 return  $this->cache->set(APP_KEY . '.DOC2::' . $id, $data, 0, (int) $lifeTime);
46         }
47
48         /**
49          * {@inheritdoc}
50          */
51         protected function doDelete($id)
52         {
53                 return  $this->cache->delete(APP_KEY . '.DOC2::' . $id);
54         }
55
56         /**
57          * {@inheritdoc}
58          */
59         protected function doFlush()
60         {
61                 return  $this->cache->flush();
62         }
63
64         /**
65          * {@inheritdoc}
66          */
67         protected function doGetStats()
68         {
69                 return array();
70         }
71 }