本文整理汇总了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;
}
示例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();
};