diff --git a/examples/idx-api-with-cache.php b/examples/idx-api-with-cache.php deleted file mode 100644 index ab0bbda..0000000 --- a/examples/idx-api-with-cache.php +++ /dev/null @@ -1,51 +0,0 @@ -args['method'] ) { - return parent::request(); - } - - // We md5 the route to create a unique key for that call and to also reduce the risk of - // creating a key that is over 64 characters long, aka the max length for option names. - $transient_key = 'idxbroker_cache_' . md5( $this->route ); - - // Check if cache for API call exists. - $request = get_transient( $transient_key ); - - // If nothing is found, make the request. - if ( true === $force_refresh || false === $request ) { - // Parent method handles the request to IDX Broker. - $request = parent::request(); - - if ( false !== $request ) { - set_transient( $transient_key, $request, 2 * HOUR_IN_SECONDS ); - } - } - - return $request; - } - -}