diff src/c/urweb.c @ 2204:01c8aceac480

Finishes initial prototype, caching parameterless pages with table-match-based invalidation. Still has problems parsing non-Postgres SQL dialects properly.
author Ziv Scully <ziv@mit.edu>
date Tue, 27 May 2014 21:14:13 -0400
parents 94529780bbcf
children c1a62ce47083
line wrap: on
line diff
--- a/src/c/urweb.c	Tue Mar 25 02:04:06 2014 -0400
+++ b/src/c/urweb.c	Tue May 27 21:14:13 2014 -0400
@@ -477,6 +477,9 @@
 
   char *output_buffer;
   size_t output_buffer_size;
+
+  // For caching.
+  char *recording;
 };
 
 size_t uw_headers_max = SIZE_MAX;
@@ -560,6 +563,8 @@
   ctx->output_buffer = malloc(1);
   ctx->output_buffer_size = 1;
 
+  ctx->recording = 0;
+
   return ctx;
 }
 
@@ -1636,6 +1641,19 @@
   *ctx->page.front = 0;
 }
 
+void uw_recordingStart(uw_context ctx) {
+  // TODO: remove following debug statement.
+  uw_write(ctx, "<!--Recording started here-->");
+  ctx->recording = ctx->page.front;
+}
+
+char *uw_recordingRead(uw_context ctx) {
+  char *recording = strdup(ctx->recording);
+  // TODO: remove following debug statement.
+  uw_write(ctx, "<!--Recording read here-->");
+  return recording;
+}
+
 char *uw_Basis_attrifyInt(uw_context ctx, uw_Basis_int n) {
   char *result;
   int len;