Caching HTTP Responses with CherryPy
Wednesday, February 25th, 2009The most basic case is very simple.
import time
import cherrypy
class WebSvc(object):
@cherrypy.tools.caching(delay=300)
@cherrypy.expose
def quadruple(self, number):
time.sleep(1) # make the real call somewhat costly
return str(int(number) * 4)
cherrypy.quickstart(WebSvc())
That uses an in-memory cache and [...]