Created
July 10, 2012 10:15
-
-
Save ivoba/3082497 to your computer and use it in GitHub Desktop.
symfony2 caching data via doctrine/commons
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
$cache = $this->get('cache'); | |
$cache->setNamespace('mynamespace.cache'); | |
if (false === ($cached_data = $cache->fetch($cache_key))) { | |
$cached_data = $SOMEAPI->getData($params); | |
$cache->save($cache_key, $cached_data, 3600);//TTL 1h | |
} |
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
cache: | |
class: Doctrine\Common\Cache\PhpFileCache | |
arguments: [%kernel.cache_dir%] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment