[Web-SIG] wsgiMemcached and wsgiAdvogato.

Titus Brown titus at caltech.edu
Sun Feb 13 08:51:08 CET 2005


Hi all,

I continued my hobby of implementing simple WSGI apps for fun,
and implemented one piece of middleware, wsgiMemcached, and
once piece of endware, wsgiPullAdvogato.

wsgiMemcached uses the Python API to memcached,

	http://www.danga.com/memcached/

to cache pages by their URL (according to PATH_INFO).

wsgiPullAdvogato uses the XML-RPC API to advogato.org to pull down
diary entries from advogato.org, e.g.

	http://issola.caltech.edu/~t/qwsgi/wsgi-cgi-gw.cgi/titus/50

pulls down the 50th entry from my diary.  Warning -- it's not very
error tolerant ;).

Both are available off of
	
	http://darcs.idyll.org/~t/projects/

under the 'wsgiMisc' project.  See the 'wsgi-cgi-gw.cgi' script
for an example use.

--

The main problem I ran into with caching was determining when a cache
entry was stale.  At the moment I implemented a simple function
'app.fresher_than(path_info, time_val)' that returns True if the
cache entry should be discarded & regenerated.  Unfortunately
this function must then be implemented by the downstream app.  Any
thoughts/suggestions on this?

It sure is fun to be able to chain applications like this... it's also
nice to be able to switch between CGI and SCGI with no trouble
whatsoever.

cheers,
--titus


More information about the Web-SIG mailing list