Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* README with expire and TTL info. Now it selects on the expires inst…

…ead of TTL.
  • Loading branch information...
commit d52b0f3888045c9e4fe9e842634ed13a4a3d4933 1 parent 8a63c69
António P. P. Almeida authored
Showing with 8 additions and 5 deletions.
  1. +5 −2 README.md
  2. +3 −3 nginx-cache-inspector
7 README.md
View
@@ -11,13 +11,16 @@ It accepts a
[`grep` pattern](http://www.gnu.org/software/grep/manual/grep.html#Fundamental-Structure)
as argument to search for cached items in the given cache directory.
+It prints the **cache key**, **Time To Live** (TTL) and **expire**
+date. Both TTL and expire are printed in
+[UNIX time](https://en.wikipedia.org/wiki/Unix_time).
+
This script uses `grep`
[**basic**](http://www.gnu.org/software/grep/manual/grep.html#Basic-vs-Extended)
regular expressions. Pressuposes the use of
[GNU `grep`](http://www.gnu.org/software/grep/manual/grep.html).
-The script **requires** `rw` (read-write) access to the cache
-directory.
+The script **requires** `r` (read) access to the cache directory.
## Usage
6 nginx-cache-inspector
View
@@ -85,10 +85,10 @@ function nginx_cache_inspect_item() {
if [ -n "$key" ]; then
echo "file: $i"
ttl=$(get_cache_item_ttl $i)
- ## If the TTL is negative that means that the item is
- ## not found or other error.
- [ $ttl -lt 0 ] && ttl=0
+ ## If the expire timestamp is negative that means that
+ ## the item is not found or other error.
expires=$(expr $ttl - $(date +%s))
+ [ $expires -lt 0 ] && ttl=0 && expires=0
echo "key: $key TTL: $ttl EXPIRES: $expires"
fi
done
Please sign in to comment.
Something went wrong with that request. Please try again.