Skip to content

Instantly share code, notes, and snippets.

@ikuwow
Created August 15, 2015 09:39
Show Gist options
  • Save ikuwow/93992048d44712819cc8 to your computer and use it in GitHub Desktop.
Save ikuwow/93992048d44712819cc8 to your computer and use it in GitHub Desktop.
CakePHP2でのElementキャッシュで見た目から処理を減らしていく ref: http://qiita.com/ikuwow/items/bf2e0e4c2ca289a3655d
$this->Element('user_ranking', [], [
'cache' => true
]);
$ranking = $this->requestAction([
'controller' => 'Users',
'action' => 'getUserRanking'
]);
public function getUserRanking() {
if ($this->request->is('requested')) {
// requestAction()時のみrankingを返す
return $this->UserRanking->getUserRanking();
}
throw new BadRequestException();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment