1

Xcache で cacheengine を使用しようとすると問題が発生します。

ファイルまたは Memcache を使用すると、キャッシュ エンジンは正常に動作し、データを保存してキャッシュから正常に読み取ります。

Xcache を使用しようとすると、データが保存されます (Cache::Write() は 1 を返します) が、Cache::read() は何も返しません。

私のbootstrap.phpでは:

Cache::config('12h', array(
                          'engine'   => 'Xcache',
                          'duration' => '+12 hours',
//                          'path'     => CACHE,
//                          'prefix'   => 'cake_12h_'
                     ));

core.php で:

Cache::config('Xcache', array(
                             'engine' => 'Xcache', //[required]
                             'duration'    => 3600, //[optional]
                             'probability' => 100, //[optional]
                        ));

キャッシュを使用する主な機能:

public function pronostics() {

        $this->set('title_for_layout', 'Pronostics');

        if ($this->_isUserLogged()) {

            $pronostics = Cache::read('pronostics', '12h');

            if (!$pronostics || isset($this->request->query['force'])) {
                $loginUrl = self::SITE_API_URL . '/api/getPronostics?auth_key=123&user_id=' . self::SITE_ID;

                list($httpCode, $res) = $this->_curlIt($loginUrl, false, false);

                if ($httpCode === 200) {
                    $res = json_decode($res);
                    if (is_object($res) && $res->status == 'success') {

                        $pronostics = $res->pronostics;

                        $res = Cache::write('pronostics', $pronostics, '12h');
                        $this->log($res, 'curl');
                    } else {
                        $this->redirect(array('controller' => 'interactions', 'action' => 'pronostics'));
                    }
                }
            }

            $this->set('pronostics', $pronostics);

        } else {
            $this->Session->setFlash('Pour accéder aux pronostics, vous devez être identifié.', 'default', array(), 'error');
            $this->redirect(array('controller' => 'interactions', 'action' => 'index', '?' => array('login_error' => 1)));
        }
    }

私の場合、なぜ xcache が機能しないのか知っていますか? ありがとう。

4

0 に答える 0