A WP library for caching remote files

dev-master 2019-02-06 16:48 UTC

This package is auto-updated.

Last update: 2024-05-28 03:37:44 UTC


A WP library for caching remote files. It caches the hash of the remote file in WP options table, avoiding multiple remote requests on the same file if the local file is up to date, saving bandwidth. It is done through a tiny HEAD request.


composer require otgs/remote-files-cache


Checking if the cached file is up to date:

$remote_file_cache = new OTGS_Remote_File_Cache( 'http://my-awesome.url' );

if ( $remote_file_cache->is_up_to_date() ) {
    //do not do the remote request

Updating cache:

$remote_file_cache = new OTGS_Remote_File_Cache( 'http://my-awesome.url' );

//Do your stuff: request the file, etc.