From 64aa1e47a6ddab5a8b5f22ebda1944ab8bd60696 Mon Sep 17 00:00:00 2001 From: Tom Scavo Date: Tue, 2 May 2017 09:27:41 -0400 Subject: [PATCH] Update example in overview section --- README.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 35ec0a2..f4bd9c5 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,17 @@ To illustrate, define a couple of HTTP resources, a cache, and a log file: $ url1=http://md.incommon.org/InCommon/InCommon-metadata-preview.xml $ url2=http://md.incommon.org/InCommon/InCommon-metadata-fallback.xml $ export CACHE_DIR=/tmp/http_cache -$ export LOG_FILE=$CACHE_DIR/cget_log.txt -$ touch $LOG_FILE +$ export LOG_FILE=/dev/tty ``` GET the first resource: ```Shell $ $BIN_DIR/cget.sh $url1 > /dev/null +2017-05-02T13:24:57Z INFO cget.sh requesting resource: http://md.incommon.org/InCommon/InCommon-metadata-preview.xml +2017-05-02T13:26:11Z INFO conditional_get received response code: 200 +2017-05-02T13:26:11Z INFO conditional_get writing cached content file: /tmp/http_cache/1e6b844a49d1850b82feded72cf83ed7_content +2017-05-02T13:26:12Z INFO conditional_get reading cached content file: /tmp/http_cache/1e6b844a49d1850b82feded72cf83ed7_content $ echo $? 0 $ ls -1 $CACHE_DIR @@ -74,19 +77,15 @@ ETag: "299866f-54e0286fb789a" Accept-Ranges: bytes Content-Length: 43615855 Content-Type: application/samlmetadata+xml - -$ cat $CACHE_DIR/cget_log.txt -2017-04-26T16:29:44Z INFO cget.sh requesting resource: http://md.incommon.org/InCommon/InCommon-metadata-preview.xml -2017-04-26T16:30:09Z INFO conditional_get received response code: 200 -2017-04-26T16:30:10Z INFO conditional_get writing cached content file: /tmp/http_cache/1e6b844a49d1850b82feded72cf83ed7_content -2017-04-26T16:30:10Z INFO conditional_get reading cached content file: /tmp/http_cache/1e6b844a49d1850b82feded72cf83ed7_content ``` Assuming the resource doesn't change on the server, subsequent requests will return the cached resource. To bypass the network altogether, use the ``-C`` option: ```Shell $ $BIN_DIR/cget.sh -C $url1 | wc -c - 43615855 +2017-05-02T13:27:07Z INFO cget.sh requesting resource: http://md.incommon.org/InCommon/InCommon-metadata-preview.xml +2017-05-02T13:27:07Z INFO conditional_get reading cached content file: /tmp/http_cache/1e6b844a49d1850b82feded72cf83ed7_content + 43765172 ``` Of course the ``-C`` option will fail if the resource is not cached: