notebook/cache
src/notebook/cache.tur
defn
cache-open
(cache-open [dir :cstr])
open a cache rooted at the given directory.
Parameters
| dir | cache directory path, or "" to use .turnb-cache |
Returns
An opaque cache handle.
Example
(cache-open ".turnb-cache")
Since: notebook-v0.1.0
defn
cache-close
(cache-close [cache :int])
free a cache handle.
Parameters
| cache | cache handle returned by cache-open |
Example
(cache-close cache)
Since: notebook-v0.1.0
defn
cache-get
(cache-get [cache :int key :cstr])
load a cached cell-output by key, or 0 on miss.
Parameters
| cache | cache handle returned by cache-open | |
| key | SHA-256 cache key |
Returns
A cell-output-compatible handle, or 0 if the key is absent.
Example
(cache-get cache "abc123")
Since: notebook-v0.1.0
defn
cache-put
(cache-put [cache :int key :cstr output :int])
write a cell-output to disk under the given key.
Parameters
| cache | cache handle returned by cache-open | |
| key | SHA-256 cache key | |
| output | cell-output handle to persist |
Example
(cache-put cache key output)
Since: notebook-v0.1.0
defn
cache-clear
(cache-clear [cache :int])
remove every cached entry from the cache directory.
Parameters
| cache | cache handle returned by cache-open |
Example
(cache-clear cache)
Since: notebook-v0.1.0
Internal definitions
__nbc-cache-dir-default__nbc-cstr-empty?__nbc-cache-make__nbc-ensure-dir__nbc-path