I am trying to disable Hunchentoot's caching of pages, to streamline web development on local host.
As I understand, the function no-cache is meant to be used, but I'm unsure how to incorporate this. I currently have the following code that evaluates without error, however this is relates to dynamically served content, so I am unable to check whether the no-cache function is correct. Also I have no idea how to add handler functions to handlers.
(hunchentoot:define-easy-handler
(test-fn :uri "/test.html") (name)
(setf (hunchentoot:content-type*) "text/plain")
(hunchentoot:no-cache)
(format nil "Hey~@[ ~A~]!" name))
I'm unable to find a way to add no-cache to static dispatch and handlers, such as the following:
(push (hunchentoot:create-static-file-dispatcher-and-handler
"/url.html" "/path/to/www_/actual-page.html")
hunchentoot:*dispatch-table*)
The above example bypasses caching because I believe it is dynamically serving the page.
Below is my server configuration. Static pages are being cached currently. I would like to understand the Hunchentoot mechanism to disable cache for all resources but also disabling for specified resources (leaving it on for other resources).
(defvar *ssg-web-server* (hunchentoot:start
(make-instance 'hunchentoot:easy-acceptor
:address "127.0.0.1"
:port 4242
:document-root #p"/path/to/www_/"
:persistent-connections-p t
:read-timeout 3.0
:write-timeout 3.0
:access-log-destination nil
:message-log-destination nil)))
create-static-file-dispatcher-and-handler
accepts a callback:I suppose you can write:
And you would pass this function as follows, namely with a NIL content-type and the callback function: