From d9f0c32d8104fca252231720ad65e1276cc0b4b2 Mon Sep 17 00:00:00 2001 From: LogMANOriginal Date: Sat, 10 Sep 2016 17:17:07 +0200 Subject: [PATCH] Destroyed HttpCachingBridgeAbstract (markdown) --- HttpCachingBridgeAbstract.md | 45 ------------------------------------ 1 file changed, 45 deletions(-) delete mode 100644 HttpCachingBridgeAbstract.md diff --git a/HttpCachingBridgeAbstract.md b/HttpCachingBridgeAbstract.md deleted file mode 100644 index 59f8ade..0000000 --- a/HttpCachingBridgeAbstract.md +++ /dev/null @@ -1,45 +0,0 @@ -`HttpCachingBridgeAbstract` extends [`BridgeAbstract`](BridgeAbstract) and adds functions to store contents into a local cache in order to reduce bandwidth requirements. - -**Usage example**: _Your bridge loads one page and collects a range of items. Optionally the full article can be included for each item. It is not recommended to always download ALL full articles. Instead full articles of already requested items can be stored in the local cache, so the next time the same request is processed, the full articles are loaded from cache rather than re-downloading them from the internet again._ - -To create a new Bridge extending `HttpCachingBridgeAbstract` you must implement all required functions of [`BridgeAbstract`](BridgeAbstract). `HttpCachingBridgeAbstract` additionally provides following functions: - -* [`get_cached`](#the-get_cached-function) - -Find a [template](#template) at the end of this file. - -## The `get_cached` function - -This function receives the contents of a given URL from cache or, in case the contents have not yet been cached, from the internet. You can optionally pass the cache duration as second parameter. If no cache duration is specified, the default value of 24h (86400 seconds) applies. - -```PHP -$this->get_cached('your URL', 86400); -``` - -or if you require the HTML DOM: - -```PHP -$html = str_get_html($this->get_cached('your URL', 86400)); -``` - -# Template - -This is the template for a new bridge: - -```PHP -get_cached('your URL', 43200)); // 12h duration - } -} -// Imaginary empty line! -``` \ No newline at end of file