CDN Hosted Cache Files – Check Files exists in CDN
-
Hi,
We have developed a CDN hosted site and some of our files are upload to AWS S3 via custom user meta.
Since the files resides on different folder and not from media, they will not be uploaded or kept track by w3.
What we want to achieve is to check if the remote CDN files and if the file is different or not update (timestamp), we will upload the new file and purge the cache.
We are able to purge the cache, but we don’t know how to check if the file already exists in the CDN.
If it helps I have attached how we purge CDN via code:
$purgeitems = array(); foreach ($files as $file) { $common = \W3TC\Dispatcher::component('Cdn_Core'); if (file_exists($file)) { $local_path = $file; } else { $local_path = ABSPATH . $file; } $remote_path = $file; $purgeitems[] = $common->build_file_descriptor($local_path, $remote_path); } $o = \W3TC\Dispatcher::component('CacheFlush'); $o->cdn_purge_files($purgeitems); write_log("W3TC Purging done for file " . $image_file);
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘CDN Hosted Cache Files – Check Files exists in CDN’ is closed to new replies.