Excerpts from Diego Olivier Fernandez Pons's message of Sun Jan 29 10:56:25 
+0100 2012:
> On the other hand, the data I am working with has good properties
> - read only
Libraries like smarty (PHP caching framework) do it this way :

fun render_and_cache_id (id)
  let query_db_then_render = fun() -> build_html ( query_db ( id_of_thing .. ))
  return cache(id, timeout, render_html)
endf

id is the id identifying the database data. Thus for each id the
database is queried only once - and the data is only rendered once.

Obviously this only works great if you have readonly data - or if its ok
if your data is out of date. You can invalidate it using timeouts etc.

Marc Weber

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to