Sob*_*nka 3 mysql caching innodb cakephp cakephp-2.3
我发生了以下查询
public function test()
{
$uuid = substr( String::uuid() , 4 , rand( 7 , 10 ) );
$name = $uuid;
$event = $this->Event->getEvent( array( "event_id" => "5240e695-9acc-4e32-9b98-1aecb3d0838" ) );
$event[ "event_name" ] = $name;
$this->Event->update( $event );
debug( $this->Event->search( array( "event_id" => $event[ "event_id"] ) )[ 0 ][ "event_name" ] );
debug( $this->Event->search( array( "event_id" => $event[ "event_id"] , "limit" => 1 ) )[ 0 ][ "event_name" ] );
}
Run Code Online (Sandbox Code Playgroud)
我为从mySQL(InnoDB)表中检索的特定事件分配一个随机名称event,为其分配一个随机的新名称,并将其保存回数据库中.
当我在此代码中运行最后两个语句时,结果不一样,请注意第二个查询中的最后一个参数只是将LIMIT 1添加到第二个查询的末尾.(我没有使用CakePHP 2.x搜索表的典型方法).第一次搜索调用的结果将产生先前请求的先前结果,而第二次搜索调用将在event表中产生实际当前更新的名称.
我一直在寻找如何从数据源对象中删除查询缓存COMPLETELY,但无法弄清楚如何.我已经尝试在数据源对象上使用flushMethodCache(),但它什么也没做,我试过设置
$cacheQueries = false, $cacheSources = false;
Run Code Online (Sandbox Code Playgroud)
在AppModel中,但也没有做任何事情.我已经尝试查看/App/Config/Core.php并禁用缓存,并将缓存时间设置为0.这都不起作用.
Sob*_*nka 11
发现问题:
而不是打电话
$model->query( $string );
我需要打电话
$model->query( $string, false );