The public API of the urlocal library.
The public API of the urlocal library.
(input-stream url)
(input-stream url
{:keys [connect-timeout read-timeout follow-redirects?
request-headers]
:or {connect-timeout 1000
read-timeout 1000
follow-redirects? false
request-headers {"User-Agent" "com.github.pmonks/urlocal"}}
:as opts})
Returns an InputStream for potentially cached content retrieved from url (a String, java.net.URL or java.net.URI), or nil if url is nil or unsupported (i.e. is not an http(s) URL).
The options map provides these tunables, all of them optional:
:connect-timeout
(int, default=1000): the number of milliseconds to wait when
establishing the socket connection before timing out:read-timeout
(int, default=1000): the number of milliseconds to wait when
reading content over the socket before timing out:read-timeout
(int, default=1000): the number of milliseconds to wait when
reading content over the socket before timing out:follows-redirects?
(boolean, default=false): whether to follow redirects
(HTTP status codes 301, 302) if the server issues one:request-headers
(map with string keys and values): a map of request
headers to send along with the requestThrows on IO errors.
Returns an InputStream for potentially cached content retrieved from url (a String, java.net.URL or java.net.URI), or nil if url is nil or unsupported (i.e. is not an http(s) URL). The options map provides these tunables, all of them optional: * `:connect-timeout` (int, default=1000): the number of milliseconds to wait when establishing the socket connection before timing out * `:read-timeout` (int, default=1000): the number of milliseconds to wait when reading content over the socket before timing out * `:read-timeout` (int, default=1000): the number of milliseconds to wait when reading content over the socket before timing out * `:follows-redirects?` (boolean, default=false): whether to follow redirects (HTTP status codes 301, 302) if the server issues one * `:request-headers` (map with string keys and values): a map of request headers to send along with the request Throws on IO errors.
(reset-cache!)
Resets (i.e. deletes) the local cache, returning nil.
Throws on IO errors.
Resets (i.e. deletes) the local cache, returning nil. Throws on IO errors.
(set-cache-check-interval-secs! cache-check-interval-secs)
Sets the cache check interval, in seconds. Default is 86,400 (24 hours).
Sets the cache check interval, in seconds. Default is 86,400 (24 hours).
(set-cache-name! name)
Sets the name of the cache (which ends up being part of the cache directory's name), and returns nil. Default is 'urlocal'.
Notes:
reset-cache!
prior to setting a new name.Sets the name of the cache (which ends up being part of the cache directory's name), and returns nil. Default is 'urlocal'. Notes: * name must not be blank. * the new cache may not be empty if it was previously populated. * setting a new name after a previously named cache has already been populated will 'orphan' the prior cache. To avoid this, you should call [[reset-cache!]] prior to setting a new name.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close