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 the given URL.

Throws on IO errors.

Handles a cache hit, by updating the :last-checked-at metadata.  Assumes that
the cache is already populated with the given 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? opts)

Handles a cache miss, by caching content locally and capturing metadata from the response for the purposes of cache management.

source may be:

  • a URL, in which case an HTTP GET request is made
  • a 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.

source may be:
* a URL, in which case an HTTP GET request is made
* a 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 the given URL.

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
the given URL.

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 follow-redirects?
                  request-headers]
           :or {connect-timeout 1000
                read-timeout 1000
                follow-redirects? false
                request-headers {"User-Agent" "com.github.pmonks/urlocal"}}})

Perform an HTTP GET request for the given URL, using the given options, returning an HTTPUrlConnection object.

Throws on IO errors.

Perform an HTTP GET request for the given URL, using the given options,
returning an HTTPUrlConnection object.

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.

Note: does nothing if the connection did not return an ETag - this ensures that future requests to the same URL will always be treated as a cache miss.

Writes out a metadata file for the given open connection.

Note: does nothing if the connection did not return an ETag - this ensures
that future requests to the same URL will always be treated as a cache miss.
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