Mercurial > urweb
comparison caching-tests/bench.ur @ 2293:8be54d7bd06e
Trivial change to benchmark.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Wed, 18 Nov 2015 14:48:24 -0500 |
parents | 23eaec04e0f8 |
children |
comparison
equal
deleted
inserted
replaced
2292:23eaec04e0f8 | 2293:8be54d7bd06e |
---|---|
1 table tab : {Id : int, Val : int} PRIMARY KEY Id | 1 table tab : {Id : int, Val : int} PRIMARY KEY Id |
2 | 2 |
3 fun check id = | 3 fun check id = |
4 res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]}); | 4 res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]}); |
5 return <xml><body> | 5 return <xml><body> |
6 cache | 6 Value at {[id]} is |
7 {case res of | 7 {case res of |
8 None => <xml>?</xml> | 8 None => <xml>unknown</xml> |
9 | Some row => <xml>{[row.Tab.Val]}</xml>} | 9 | Some row => <xml>{[row.Tab.Val]}</xml>}. |
10 </body></xml> | 10 </body></xml> |
11 | 11 |
12 fun flush id = | 12 fun flush id = |
13 dml (UPDATE tab SET Val = Val + 1 WHERE Id = {[id]}); | 13 dml (UPDATE tab SET Val = Val + 1 WHERE Id = {[id]}); |
14 return <xml><body> | 14 return <xml><body> |
15 Changed {[id]}! | 15 Incremented value at {[id]} (if it exists). |
16 </body></xml> | 16 </body></xml> |