File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Test/Case/Model/Datasource Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -3540,6 +3540,15 @@ public function introspectType($value) {
3540
3540
return 'string ' ;
3541
3541
}
3542
3542
3543
+ /**
3544
+ * Empties the query caches.
3545
+ *
3546
+ * @return void
3547
+ */
3548
+ public function flushQueryCache () {
3549
+ $ this ->_queryCache = array ();
3550
+ }
3551
+
3543
3552
/**
3544
3553
* Writes a new key for the in memory sql query cache
3545
3554
*
Original file line number Diff line number Diff line change @@ -1810,4 +1810,20 @@ public function testHasOneAfterFind() {
1810
1810
$ User ->Article = $ Article ;
1811
1811
$ User ->find ('first ' , array ('conditions ' => array ('User.id ' => 1 ), 'recursive ' => 2 ));
1812
1812
}
1813
+
1814
+ /**
1815
+ * Test that flushQueryCache works as expected
1816
+ *
1817
+ * @return void
1818
+ */
1819
+ public function testFlushQueryCache () {
1820
+ $ this ->db ->flushQueryCache ();
1821
+ $ this ->db ->query ('SELECT 1 ' );
1822
+ $ this ->db ->query ('SELECT 1 ' );
1823
+ $ this ->db ->query ('SELECT 2 ' );
1824
+ $ this ->assertAttributeCount (2 , '_queryCache ' , $ this ->db );
1825
+
1826
+ $ this ->db ->flushQueryCache ();
1827
+ $ this ->assertAttributeCount (0 , '_queryCache ' , $ this ->db );
1828
+ }
1813
1829
}
You can’t perform that action at this time.
0 commit comments