Liking cljdoc? Tell your friends :D

urlocal.impl.cache

This namespace is not part of the public API of urlocal and may change without notice.

This namespace is not part of the public API of urlocal and may change
without notice.
raw docstring

base64-encodeclj

(base64-encode x)

Returns a BASE64 encoded representation (a String) of the UTF-8 String representation of x, or nil if x is nil

Returns a BASE64 encoded representation (a String) of the UTF-8 String
representation of x, or nil if x is nil
sourceraw docstring

cache-check-interval-secs-aclj

source

cache-dir-aclj

source

cache-hit!clj

(cache-hit! url metadata-file metadata)

Handles a cache hit, by updating the :last-checked-at metadata. Assumes that the cache is already populated with content and metadata for url. Returns url.

Throws on IO errors.

Handles a cache hit, by updating the `:last-checked-at metadata`.  Assumes
that the cache is already populated with content and metadata for `url`.
Returns `url`.

Throws on IO errors.
sourceraw docstring

cache-key->cache-fileclj

(cache-key->cache-file cache-key)
(cache-key->cache-file cache-key extension)

Returns a File for the given cache-key (a String), optionally with the given extension. Return nil if cache-key is blank.

Returns a File for the given cache-key (a String), optionally with the given
extension.  Return nil if cache-key is blank.
sourceraw docstring

cache-miss!cljmultimethod

(cache-miss! source opts)
(cache-miss! source already-redirected? already-retried? opts)

Handles a cache miss, by caching content locally and capturing metadata from the response for the purposes of cache management. Returns the url that ended up being used for the cache, which can be different to the caller's original url due to redirects.

source may be:

  • a java.net.URL, in which case an HTTP GET request is made
  • a java.net.HttpURLConnection, in which case it is assumed to already be connected

Throws on IO errors or unexpected HTTP status code responses.

Handles a cache miss, by caching content locally and capturing metadata from
the response for the purposes of cache management.  Returns the url that ended
up being used for the cache, which can be different to the caller's original
url due to redirects.

`source` may be:

* a `java.net.URL`, in which case an HTTP GET request is made
* a `java.net.HttpURLConnection`, in which case it is assumed to already be
  connected

Throws on IO errors or unexpected HTTP status code responses.
sourceraw docstring

check-cache!clj

(check-cache! url
              {:keys [request-headers return-cached-content-on-exception?]
               :as opts})

Handles a potential cache hit, by determining whether the cached content needs to be checked for staleness via an ETag request, or whether it can simply be served directly. Assumes that the cache is already populated with content and metadata for url.

Returns the url that ended up being used for the cache, which can be different to the caller's original url due to redirects.

Throws on IO errors or unexpected HTTP status code responses.

Handles a potential cache hit, by determining whether the cached content
needs to be checked for staleness via an ETag request, or whether it can
simply be served directly.  Assumes that the cache is already populated with
content and metadata for `url`.

Returns the `url` that ended up being used for the cache, which can be
different to the caller's original `url` due to redirects.

Throws on IO errors or unexpected HTTP status code responses.
sourceraw docstring

http-getclj

(http-get url)
(http-get url
          {:keys [connect-timeout read-timeout request-headers]
           :or {connect-timeout 1000
                read-timeout 1000
                request-headers {"User-Agent"
                                   "https://github.com/pmonks/urlocal"}}})

Perform an HTTP GET request for url, using the given options, returning a connected HTTPUrlConnection object. It is the caller's responsibility to disconnect the connection once processing is complete.

Throws on IO errors.

Perform an HTTP GET request for `url`, using the given options,
returning a connected `HTTPUrlConnection` object.  It is the caller's
responsibility to disconnect the connection once processing is complete.

Throws on IO errors.
sourceraw docstring

prep-cache!clj

(prep-cache! url opts)

Ensures the cache is populated for the given url.

Ensures the cache is populated for the given url.
sourceraw docstring

remove-cache-entry!clj

(remove-cache-entry! url)

Removes the cache entry for a single URL, if it exists. Returns nil.

Throws on IO errors.

Removes the cache entry for a single URL, if it exists. Returns nil.

Throws on IO errors.
sourceraw docstring

seconds-sincecljmultimethod

(seconds-since inst)

Returns how many seconds have passed since inst (a Date or Temporal), or Long/MAX_VALUE if inst is nil.

Returns how many seconds have passed since inst (a Date or Temporal), or
Long/MAX_VALUE if inst is nil.
sourceraw docstring

url->content-fileclj

(url->content-file url)

Returns a content file for the given url, or nil if the url is nil.

Returns a content file for the given url, or nil if the url is nil.
sourceraw docstring

url->metadata-fileclj

(url->metadata-file url)

Returns a metadata file for the given url, or nil if the url is nil.

Returns a metadata file for the given url, or nil if the url is nil.
sourceraw docstring

write-metadata!clj

(write-metadata! conn)

Writes out a metadata file for the given open connection.

Writes out a metadata file for the given open connection.
sourceraw docstring

write-metadata-file!clj

(write-metadata-file! f m)

Writes the metadata m to the file f, overwriting it if it already exists.

Writes the metadata m to the file f, overwriting it if it already exists.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close