Created
February 10, 2013 06:41
-
-
Save ganchiku/4748647 to your computer and use it in GitHub Desktop.
LiipDoctrineCacheBundle のサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
liip_doctrine_cache: | |
namespaces: | |
flickr: | |
namespace: flickr | |
type: file_system |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = 'http://www.flickr.com/services/rest/?' . http_build_query($params); | |
$cache_key = 'search' . md5(http_build_query($params)); | |
$cache = $this->get('liip_doctrine_cache.ns.flickr'); | |
if (false === ($cached_data = $cache->fetch($cache_key))) { | |
$cached_data = file_get_contents($url); | |
$cache->save($cache_key, $cached_data, 86400 * 30); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment