(index ("db-get" 0) ("db-get/default" 173) ("db-put" 363) ("db-delete" 749) ("db-batch" 1133) ("db-keys" 2096) ("db-values" 3064) ("db-pairs" 4044))
(def (sig (procedure "(db-get db key)" (id db-get))) (p "Returns the value of " (tt "key") " in " (tt "db") " as a string. Causes an exception if the key does not exist."))
(def (sig (procedure "(db-get/default db key default)" (id db-get/default))) (p "Same as " (tt "db-get") " but returns " (tt "default") " on missing keys instead of raising an exception."))
(def (sig (procedure "(db-put db key value #!key (sync #f))" (id db-put))) (p "Stores " (tt "value") " under " (tt "key") " in datbase " (tt "db") ". If the sync option can be set to " (tt "#t") " to make the write operation not return until the data being written has been pushed all the way to persistent storage. See the " (i "Synchronous Writes") " section for more information."))
(def (sig (procedure "(db-delete db key #!key (sync #f))" (id db-delete))) (p "Removes the value associated with " (tt "key") " from " (tt "db") ". If the sync option can be set to " (tt "#t") " to make the write operation not return until the data being written has been pushed all the way to persistent storage. See the " (i "Synchronous Writes") " section for more information."))
(def (sig (procedure "(db-batch db ops #!key (sync #f))" (id db-batch))) (p "When making multiple changes that rely on each other you can apply a batch of operations atomically using " (tt "db-batch") ". The " (tt "ops") " argument is a list of operations which will be applied " (b "in order") " (meaning you can create then later delete a value in the same batch, for example).") (highlight scheme "    \n(define myops '((put \"abc\" \"123\")\n                (put \"def\" \"456\")\n                (delete \"abc\")))\n\n;; apply all operations in myops\n(db-batch db myops)") (p "The first item in an operation should be the symbol " (tt "put") " or " (tt "delete") ", any other value will give an error. The next item is the key and in the case of " (tt "put") " the third item is the value.") (p "Apart from its atomicity benefits, " (tt "db-batch") " may also be used to speed up bulk updates by placing lots of individual mutations into the same batch."))
(def (sig (procedure "(db-keys db #!key start end limit reverse fillcache)" (id db-keys))) (p "Allows forward and backward iteration over the keys in alphabetical order. Returns a lazy sequence of all keys from " (tt "start") " to " (tt "end") " (up to " (tt "limit") "). This uses the " (link "http://wiki.call-cc.org/eggref/4/lazy-seq" "lazy-seq") " egg.") (ul (li (b "start") " - the key to start from (need not actually exist), if omitted starts from the first key in the database") (li (b "end") " - the key to end on (need not actually exist), if omitted ends on the last key in the database") (li (b "limit") " - stops after " (tt "limit") " results have been returned") (li (b "reverse") " - iterates backwards through the keys (reverse iteration may be somewhat slower than forward iteration)") (li (b "fillcache") " - whether to fill leveldb's read cache when reading (turned off by default so the bulk read does not replace most of the cached contents)")))
(def (sig (procedure "(db-values db #!key start end limit reverse fillcache)" (id db-values))) (p "Allows forward and backward iteration over the keys in alphabetical order. Returns a lazy sequence of all values pairs from " (tt "start") " to " (tt "end") " (up to " (tt "limit") "). This uses the " (link "http://wiki.call-cc.org/eggref/4/lazy-seq" "lazy-seq") " egg.") (ul (li (b "start") " - the key to start from (need not actually exist), if omitted starts from the first key in the database") (li (b "end") " - the key to end on (need not actually exist), if omitted ends on the last key in the database") (li (b "limit") " - stops after " (tt "limit") " results have been returned") (li (b "reverse") " - iterates backwards through the keys (reverse iteration may be somewhat slower than forward iteration)") (li (b "fillcache") " - whether to fill leveldb's read cache when reading (turned off by default so the bulk read does not replace most of the cached contents)")))
(def (sig (procedure "(db-pairs db #!key start end limit reverse fillcache)" (id db-pairs))) (p "Allows forward and backward iteration over the keys in alphabetical order. Returns a lazy sequence of all key/value pairs from " (tt "start") " to " (tt "end") " (up to " (tt "limit") "). This uses the " (link "http://wiki.call-cc.org/eggref/4/lazy-seq" "lazy-seq") " egg.") (ul (li (b "start") " - the key to start from (need not actually exist), if omitted starts from the first key in the database") (li (b "end") " - the key to end on (need not actually exist), if omitted ends on the last key in the database") (li (b "limit") " - stops after " (tt "limit") " results have been returned") (li (b "reverse") " - iterates backwards through the keys (reverse iteration may be somewhat slower than forward iteration)") (li (b "fillcache") " - whether to fill leveldb's read cache when reading (turned off by default so the bulk read does not replace most of the cached contents)")))
