Skip to content

Commit

Permalink
Merge pull request #2663 from CachetHQ/cache-settings
Browse files Browse the repository at this point in the history
Statically cache settings
  • Loading branch information
jbrooksuk committed Jul 26, 2017
2 parents 58717e0 + 8c1974a commit 77c7fb3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
*/
function setting($name, $default = null)
{
return app(Repository::class)->get($name, $default);
static $settings = [];

if (isset($settings[$name])) {
return $settings[$name];
}

return $settings[$name] = app(Repository::class)->get($name, $default);
}
}

Expand Down

0 comments on commit 77c7fb3

Please sign in to comment.