Introduce caching for all query methods

Change-Id: Ibe43ccc18114f64d30e7e8f1162239daf78090c0
diff --git a/t/corpus_info.t b/t/corpus_info.t
index e5d1987..1d8290b 100644
--- a/t/corpus_info.t
+++ b/t/corpus_info.t
@@ -31,6 +31,7 @@
   ->json_is('/tokens', 665842)
   ->json_is('/sentences', 25074)
   ->json_is('/paragraphs', 772)
+  ->json_is('/X-cached', undef)
   ;
 
 $t->get_ok('/corpus2?cq=docSigle+%3D+\"GOE/AGA\"')
@@ -39,6 +40,7 @@
   ->json_is('/tokens', 108557)
   ->json_is('/sentences', 3835)
   ->json_is('/paragraphs', 124)
+  ->json_is('/X-cached', undef)
   ;
 
 $t->get_ok('/corpus2?cq=4')
@@ -46,5 +48,16 @@
   ->json_is('/notifications/0/1', "302: Could not parse query >>> (4) <<<.")
   ;
 
+# Query passed
+$t->get_ok('/corpus2')
+  ->status_is(200)
+  ->json_is('/documents', 11)
+  ->json_is('/tokens', 665842)
+  ->json_is('/sentences', 25074)
+  ->json_is('/paragraphs', 772)
+  ->json_is('/X-cached', 1)
+  ;
+
+
 done_testing;
 __END__
diff --git a/t/match_info.t b/t/match_info.t
index 58191a5..c07e7aa 100644
--- a/t/match_info.t
+++ b/t/match_info.t
@@ -29,6 +29,7 @@
   ->status_is(200)
   ->json_is('/textSigle', 'WPD15/232/39681')
   ->json_like('/snippet', qr!<span class=\"context-left\">!)
+  ->json_is('/X-cached', undef)
   ;
 
 $t->get_ok('/corpus2/GOE/AGF/02286/p75682-75683')
@@ -89,6 +90,14 @@
   ->json_is('/notifications/0/1', 'Message structure failed')
   ;
 
+# Get from cache
+$t->get_ok('/corpus2/WPD15/232/39681/p2133-2134?spans=false&foundry=*')
+  ->status_is(200)
+  ->json_is('/textSigle', 'WPD15/232/39681')
+  ->json_like('/snippet', qr!<span class=\"context-left\">!)
+  ->json_is('/X-cached', 1)
+  ;
+
 
 done_testing;
 __END__