Example #1
0
 /**
  * This method can be used to give a significant performance boost to your
  * application by pre-generating and caching the routing table. Note that
  * this caching is NOT performed automatically and that the $api->cacheFile
  * property needs to be set to a writable path for this to succeed.
  *
  * @see cacheFile
  * @return void
  */
 public function createCache()
 {
     $cache = new Cache($this->cacheFile);
     $router = new Router($cache, new UrlTools());
     $table = $router->getRoutingTable($this->resources);
     $cache->set("router", $table);
 }
Example #2
0
 function testGetTableUsesCache()
 {
     $this->cache->get("router")->shouldBeCalled()->willReturn("abc");
     $table = $this->router->getRoutingTable(array(new TestResource()));
     $this->assertEquals("abc", $table);
 }