Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
ArrayApcCache.php
Go to the documentation of this file.
1<?php
2
4
14class ArrayApcCache extends ArrayCache {
15
16 public function storeContent($key, $content, $tag = null) {
17 parent::store ( $key, $content, $tag );
18 $apcK = $this->getApcKey ( $key );
19 if ($this->apcExists ( $apcK )) {
20 \apc_delete ( $apcK );
21 }
22 }
23
24 public function apcExists($key) {
25 $success = false;
26 \apc_fetch ( $key, $success );
27 return $success;
28 }
29
30 protected function apcDelete($key) {
31 $apcK = $this->getApcKey ( $key );
32 if ($this->apcExists ( $apcK )) {
33 return \apc_delete ( $apcK );
34 }
35 return false;
36 }
37
38 protected function getApcKey($key) {
39 return md5 ( $this->_root . $key );
40 }
41
47 public function fetch($key) {
48 $apcK = $this->getApcKey ( $key );
49 if ($this->apcExists ( $apcK )) {
50 return \apc_fetch ( $apcK );
51 }
52 $content = parent::fetch ( $key );
53 \apc_store ( $apcK, $content );
54 return $content;
55 }
56
62 public function remove($key) {
63 $this->apcDelete ( $key );
64 return parent::remove ( $key );
65 }
66}
This class is responsible for storing Arrays in PHP files, and require php apc.
storeContent($key, $content, $tag=null)