|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
-
-
- namespace yii\caching;
-
-
- class XCache extends Cache
- {
-
-
- public function exists($key)
- {
- $key = $this->buildKey($key);
-
- return xcache_isset($key);
- }
-
-
-
- protected function getValue($key)
- {
- return xcache_isset($key) ? xcache_get($key) : false;
- }
-
-
-
- protected function setValue($key, $value, $duration)
- {
- return xcache_set($key, $value, $duration);
- }
-
-
-
- protected function addValue($key, $value, $duration)
- {
- return !xcache_isset($key) ? $this->setValue($key, $value, $duration) : false;
- }
-
-
-
- protected function deleteValue($key)
- {
- return xcache_unset($key);
- }
-
-
-
- protected function flushValues()
- {
- for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
- if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
- return false;
- }
- }
-
- return true;
- }
- }
|