Skip to content

Instantly share code, notes, and snippets.

@ganchiku
Created February 10, 2013 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ganchiku/4748647 to your computer and use it in GitHub Desktop.
Save ganchiku/4748647 to your computer and use it in GitHub Desktop.
LiipDoctrineCacheBundle のサンプル
liip_doctrine_cache:
namespaces:
flickr:
namespace: flickr
type: file_system
$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