function _facebook_pull_feed_cached in Facebook Pull 7.3
Same name and namespace in other branches
- 6 facebook_pull.module \_facebook_pull_feed_cached()
- 7 facebook_pull.module \_facebook_pull_feed_cached()
- 7.2 facebook_pull.module \_facebook_pull_feed_cached()
Pull data from a facebook feed and cache it.
1 call to _facebook_pull_feed_cached()
- facebook_pull_render in ./
facebook_pull.module - Serve up a facebook feed from the cache.
File
- ./
facebook_pull.module, line 267 - Facebook Pull Module for getting content from Facebook graph.
Code
function _facebook_pull_feed_cached($graph_id, $type, $app_id, $app_secret, $options = array()) {
$cache_key = sprintf("%s-%s-%s", $graph_id, $type, http_build_query($options, '', '-'));
$cache = cache_get($cache_key);
if (!$cache || $cache->created + FACEBOOK_PULL_CACHETIME < REQUEST_TIME) {
$token = _facebook_pull_accesstoken($app_id, $app_secret);
$data = _facebook_pull_feed($graph_id, $type, $token, $options);
cache_set($cache_key, $data, 'cache', CACHE_TEMPORARY);
}
else {
$data = $cache->data;
}
return $data;
}