Liking cljdoc? Tell your friends :D

sql-file.query-cache

A cache of query results, as yesql query middleware.

A query is cached by giving it a cache-name info value: a vector of strings and keywords, where each keyword is replaced by the query argument of that name. A query's results are cached under that name (and the query name and arguments), and another query can clear everything cached under a name with invalidate-cache-names:

-- name: get-items-by-list
-- info-cache-name: ["list" :list_id]
SELECT * FROM item WHERE list_id = :list_id

-- name: add-item!
-- info-invalidate-cache-names: [["list" :list_id]]
INSERT INTO item (list_id, title) VALUES (:list_id, :title)

The cache itself is an atom, made by make-query-cache, that queries use only while it's bound with with-query-cache (or call-with-query-cache). With no cache bound, queries run uncached.

A cache of query results, as yesql query middleware.

A query is cached by giving it a cache-name info value: a vector of
strings and keywords, where each keyword is replaced by the query
argument of that name. A query's results are cached under that name
(and the query name and arguments), and another query can clear
everything cached under a name with invalidate-cache-names:

    -- name: get-items-by-list
    -- info-cache-name: ["list" :list_id]
    SELECT * FROM item WHERE list_id = :list_id

    -- name: add-item!
    -- info-invalidate-cache-names: [["list" :list_id]]
    INSERT INTO item (list_id, title) VALUES (:list_id, :title)

The cache itself is an atom, made by make-query-cache, that queries
use only while it's bound with with-query-cache (or
call-with-query-cache). With no cache bound, queries run uncached.
raw docstring

call-with-query-cacheclj

(call-with-query-cache query-cache f)

Call f with query-cache as the cache for queries it runs.

Call f with query-cache as the cache for queries it runs.
sourceraw docstring

clear-cache!clj

(clear-cache!)

Clear everything in the current query cache, if one is bound.

Clear everything in the current query cache, if one is bound.
sourceraw docstring

current-query-cacheclj

(current-query-cache)

The query cache bound for the current thread, or nil.

The query cache bound for the current thread, or nil.
sourceraw docstring

invalidate-cache!clj

(invalidate-cache! cache-name)

Clear what's cached under cache-name (a vector, like a query's cache-name with its arguments filled in) in the current query cache, if one is bound.

Clear what's cached under cache-name (a vector, like a query's
cache-name with its arguments filled in) in the current query cache,
if one is bound.
sourceraw docstring

make-query-cacheclj

(make-query-cache)

A new, empty query cache.

A new, empty query cache.
sourceraw docstring

query-cache-middlewareclj

(query-cache-middleware query-fn)

Query middleware that caches and invalidates query results in the current query cache, according to each query's cache-name and invalidate-cache-names info values.

Query middleware that caches and invalidates query results in the
current query cache, according to each query's cache-name and
invalidate-cache-names info values.
sourceraw docstring

with-query-cachecljmacro

(with-query-cache query-cache & body)

Run body with query-cache as the cache for queries it runs.

Run body with query-cache as the cache for queries it runs.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close