Provides reference types that refer to clojure data potentially off-heap or remotely.
e.g (let [dref (dref/persist "file:///Users/foobar/objects" 42 {:as "edn"})] @dref ;; derefable (dref/reference (uri dref)) ;; reobtain the reference from a URI (dref/value (uri dref)) ;; alternative deref operator, takes a URI (and additional options) )
Reference identity is a URI, the scheme of which determines the type. e.g volatile: mutable, non-cached value: immutable, cached & interned while references exist.
The subscheme determines the storage implementation e.g file: File system storage mem: Transient memory storage
Further storages can be found in the scheme
package.
Extend to new schemes via the multimethods read-bytes
write-bytes!
and `delete-bytes!.
The file extension of the uri determines the storage format. e.g edn edn.zip
Further formats can be found inthe format
package.
Extend to new formats via the multimethods serialize
and deserialize
.
You can deref via value
a URI, (or string uri), or a reference object obtained with reference
.
Example URI's:
volatile:mem://foo/bar/baz.edn
value:file:///Users/foobar/objects/f79975f99908e5387fca3b503d9e9adbefaafc5e.edn.zip
Provides reference types that refer to clojure data potentially off-heap or remotely. e.g (let [dref (dref/persist "file:///Users/foobar/objects" 42 {:as "edn"})] @dref ;; derefable (dref/reference (uri dref)) ;; reobtain the reference from a URI (dref/value (uri dref)) ;; alternative deref operator, takes a URI (and additional options) ) Reference identity is a URI, the scheme of which determines the type. e.g volatile: mutable, non-cached value: immutable, cached & interned while references exist. The subscheme determines the storage implementation e.g file: File system storage mem: Transient memory storage Further storages can be found in the `scheme` package. Extend to new schemes via the multimethods `read-bytes` `write-bytes!` and `delete-bytes!. The file extension of the uri determines the storage format. e.g edn edn.zip Further formats can be found inthe `format` package. Extend to new formats via the multimethods `serialize` and `deserialize`. You can deref via `value` a URI, (or string uri), or a reference object obtained with `reference`. Example URI's: `volatile:mem://foo/bar/baz.edn` `value:file:///Users/foobar/objects/f79975f99908e5387fca3b503d9e9adbefaafc5e.edn.zip`
(atomic-swap! dref f)
(atomic-swap! dref f opts)
Applies f
to the value held by the ref atomically.
Applies `f` to the value held by the ref atomically.
(delete! dref)
(delete! dref opts)
Deletes a reference from storage.
Accepts anything (apart from readonly refs) that can be referenced via reference
.
Deletes a reference from storage. Accepts anything (apart from readonly refs) that can be referenced via `reference`.
(evict! dref)
Forceably removes any cached value from the ref if present.
Forceably removes any cached value from the ref if present.
(existing-ref obj)
If an existing, realized reference can be be found in memory for an identical object, it will be returned.
If an existing, realized reference can be be found in memory for an identical object, it will be returned.
(overwrite! dref obj)
(overwrite! dref obj opts)
Writes the obj to the mutable ref.
Writes the obj to the mutable ref.
(persist base-uri obj)
(persist base-uri obj opts)
Persists the obj to a unique location (by value) under base-uri
.
Returns a DurableValueRef to the object.
The format of the returned ref will be determined by the :as
option (edn by default).
Persists the obj to a unique location (by value) under `base-uri`. Returns a DurableValueRef to the object. The format of the returned ref will be determined by the `:as` option (edn by default).
(reference uri)
Returns a ref for the URI according to the scheme. e.g value:mem:/foo/bar.
Returns a ref for the URI according to the scheme. e.g value:mem:/foo/bar.
(value dref)
(value dref opts)
Attempts to derefence a durable reference and returns a value.
dref can be a anything accepted by reference
.
May throw an error if in the case of a value ref, storage has been mutated. (override with the verify-hash-identity var), it may also throw in general if storage is unavailable or crashes for whatever reason.
Attempts to derefence a durable reference and returns a value. dref can be a anything accepted by `reference`. May throw an error if in the case of a value ref, storage has been mutated. (override with the *verify-hash-identity* var), it may also throw in general if storage is unavailable or crashes for whatever reason.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close