execute() public method

Checks the cache to see if this query exists and returns it. If it's not in the cache then the query is run, stored and then returned.
public execute ( ) : Result
return Result The result of the query.
Example #1
0
 public function testCache()
 {
     if (!ini_get('apc.enable_cli')) {
         $this->markTestSkipped('The APC extension is not enabled on the command line. Set apc.enable_cli=1.');
     }
     $path = __DIR__ . '/fixtures/datastore/querytest';
     $config = new Config($path . '/');
     $repo = new Repository('countries', $config);
     $query = new CachedQuery($repo);
     $total = 0;
     for ($i = 0; $i < 100; $i++) {
         $start = microtime(true);
         $query->where('cca2', '==', 'GB');
         $query->execute();
         $total += microtime(true) - $start;
     }
 }