Skip to content

Instantly share code, notes, and snippets.

@frostbitten
Last active July 22, 2016 01:25
Show Gist options
  • Save frostbitten/957b32a91860c58519ab81188dcd3d11 to your computer and use it in GitHub Desktop.
Save frostbitten/957b32a91860c58519ab81188dcd3d11 to your computer and use it in GitHub Desktop.
try some sitesettings caching
<?php
$stash_options = array('path' => $app->config('base.path') . DIRECTORY_SEPARATOR . 'stash-cache');
$stash_driver = new \Stash\Driver\FileSystem($stash_options);
$app->pool = new \Stash\Pool($stash_driver);
error_log('before sitesettings: '.microtime(1));
$uri_public_root = $app->config('uri')['public'];
$item = $app->pool->getItem('UserFrosting SiteSettings '.urlencode($uri_public_root));
if($item->isMiss())
{
//is not valid
$item->set(new \UserFrosting\SiteSettings($setting_values, $setting_descriptions));
$app->pool->save($item);
}else{
//is valid
}
$app->site = $item->get();
error_log('after sitesettings: '.microtime(1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment