public function testRuleWithMultipleAsterixNotationForRoutesToInvalidate() { Cash::rule('put', 'some/route', 'some/other/*/random/*'); \MemcachedDriver::shouldReceive('get')->with('tag:some/other')->once()->andReturn('/some/other/route;/some/other/different/route'); \MemcachedDriver::shouldReceive('forget')->with('/some/other/route')->once(); \MemcachedDriver::shouldReceive('forget')->with('/some/other/different/route')->once(); $this->call('PUT', 'some/route'); }
public function testStoringWithAlreadyCachedResponses() { Route::get('a/{b}', array('after' => 'cash', function () { return 'Hello World'; })); \MemcachedDriver::shouldReceive('put')->with('/a/2', 'Hello World', 0)->once(); \MemcachedDriver::shouldReceive('get')->with('tag:a')->once()->andReturn('/a/1'); \MemcachedDriver::shouldReceive('put')->with('tag:a', '/a/1;/a/2', 0)->once(); $this->call('GET', 'a/2'); }