Last active
December 2, 2015 22:23
-
-
Save c-garcia/45cf61eb3bd21d8f2706 to your computer and use it in GitHub Desktop.
Receives an HTTP request (a ring-map) and decides if it needs to forward the request to the real server or if it can do it by itself with the data it already has (cache).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn process-request | |
"The heart of the Application Gateway. Checks if word is not _forbidden_ or | |
_cached_ and if is not the case, it forwards the request to the orignal | |
server." | |
[word] | |
(debug "Received request for word" word) | |
(cond | |
(forbidden? word) (forbidden-response word) | |
(cached? word) (cached-response word) | |
:else (forward-request-and-cache! word (env :forward-port)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment