Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Podio example with Redis caching
// Setup Podio Client
// Setup Redis
$redis = new Predis\Client(REDIS_INFO)
$my_cache_key = "podio_cache";
if ($redis->exists($my_cache_key)) {
// We have a cached copy, use that
$my_data = $redis->get($my_cache_key);
else {
// No cache or cache expired, contact Podio
// Authenticate as an app
Podio::authenticate('app', array('app_id' => APP_ID, 'app_token' => APP_TOKEN));
// Get a single item
$item = PodioItem::get(ITEM_ID);
// Find the value of the 'title' field
$my_data = $item->fields['title']->values;
// Store in cache
$redis->set($my_cache_key, $my_data);
$redis->expire($my_cache_key, 60*60*12); // Expire in 12 hours
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.