var cache = require('./lib/connect-cache');
var connect = require('connect');

function helloWorld(req, res) {
  res.writeHead(200, { 'Content-Type': 'text/plain' });
  if (req.url == '/') {
    res.write('no cached result');
  }
  if (req.url == '/path') {
    res.write('cached result');
  }
  res.end('');
}
var server = connect.createServer(cache({regex: /path/,
                                         ttl: 60}),
                                  helloWorld);

server.listen(3000);
@@ -104,16 +104,42 @@
  res) %7B%0A
+  if (req.url == '/') %7B%0A  
   res.wr
@@ -188,16 +188,74 @@
 ' %7D);%0A  
+  res.write('direct result');%0A    res.end('');%0A  %7D%0A  else 
 if (req.
@@ -255,32 +255,36 @@
 f (req.url == '/
+path
 ') %7B%0A    res.wri
@@ -289,61 +289,219 @@
 rite
-('no cached result');%0A  %7D%0A  if (req.url == '/path') %7B
+Head(200, %7B 'Content-Type': 'text/plain' %7D);%0A    setTimeout(function () %7B%0A      res.write('cached result');%0A      res.end('');%0A    %7D, 1000);%0A  %7D%0A  else %7B%0A    res.writeHead(404, %7B 'Content-Type': 'text/plain' %7D);
 %0A   
@@ -516,29 +516,23 @@
 te('
-cached result
+not found
 ');%0A  
-%7D%0A
   re
@@ -542,16 +542,20 @@
 nd('');%0A
+  %7D%0A
 %7D%0Avar se
@@ -601,16 +601,18 @@
 x: /path
+.*
 /,%0A     
@@ -654,16 +654,19 @@
  ttl: 60
+000
 %7D),%0A    

modify example for more efficiency