Skip to content

Commit

Permalink
Cache based on pageid
Browse files Browse the repository at this point in the history
Instead of caching based on the resources' cache key, I would cache it based on the pageid specified. By caching based on the resource cacheKey it wont find any cache for uncached resources. If you put this snippet in the footer it would then make a request for every individual page, while it could just get it from the existing cache.
  • Loading branch information
Mark-H committed Apr 15, 2012
1 parent 85410c9 commit d5a95dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fblikes.snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

$pageid = $modx->getOption('pageid',$scriptProperties,"19110642979");
$expiretime = $modx->getOption('expiretime',$scriptProperties,"10800");
$cacheKey = $modx->resource->getCacheKey().'/fblikes';
$cacheKey = 'fblikes/' . $pageid;

// get data from cache
$cached_data = $modx->cacheManager->get($cacheKey);
Expand Down

0 comments on commit d5a95dc

Please sign in to comment.