当前位置: 首页>>代码示例>>PHP>>正文


PHP R::useWriterCache方法代码示例

本文整理汇总了PHP中RedBeanPHP\R::useWriterCache方法的典型用法代码示例。如果您正苦于以下问题:PHP R::useWriterCache方法的具体用法?PHP R::useWriterCache怎么用?PHP R::useWriterCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedBeanPHP\R的用法示例。


在下文中一共展示了R::useWriterCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setDb

 /**
  * @param $name
  * @return mixed
  */
 public function setDb($name)
 {
     $this->options = $this->db[$name];
     R::setAutoResolve(TRUE);
     R::selectDatabase($name);
     R::ext('xdispense', function ($type) {
         return R::getRedBean()->dispense($type);
     });
     if ($this->cache) {
         R::useWriterCache(true);
         R::freeze(TRUE);
     }
     return $name;
 }
开发者ID:jetfirephp,项目名称:db,代码行数:18,代码来源:RedBeanConstructor.php

示例2: Connect

    $logger = $c->get('logger');
    $session = $c->get('session');
    $settings = $c->get('settings')['facebook'];
    $connect = new Connect($settings, $session, $logger);
    return $connect;
};
$container['database'] = function ($c) {
    $logger = $c->get('logger');
    $settings = $c->get('settings')['database'];
    define('QUESTION', 'quiz_question');
    define('ANSWER', 'quiz_answer');
    define('QUIZ', 'quiz_quiz');
    define('USER', 'quiz_user');
    // Create an extension to by-pass security check in R::dispense
    R::ext('xdispense', function ($type) {
        return R::getRedBean()->dispense($type);
    });
    R::renameAssociation(['quiz_answer_quiz_question' => 'quiz_answer_question', 'quiz_answer_quiz_quiz' => 'quiz_answer_quiz', 'quiz_question_quiz_quiz' => 'quiz_question_quiz']);
    define('REDBEAN_MODEL_PREFIX', '\\App\\Model\\');
    $connectionString = 'mysql:host=' . $settings['host'] . ';dbname=' . $settings['dbname'];
    R::setup($connectionString, $settings['username'], $settings['password']);
    R::useWriterCache(true);
    //R::debug(true);
    // // NEVER REMOVE THIS!
    R::freeze(true);
    return R::getRedBean();
};
$container['quiz'] = function ($c) {
    $database = $c->get('database');
    return new QuizService();
};
开发者ID:mattimatti,项目名称:fbconnectquiz,代码行数:31,代码来源:dependencies.php


注:本文中的RedBeanPHP\R::useWriterCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。