{"id":20401443,"url":"https://github.com/jackrusher/spicerack","last_synced_at":"2026-02-17T08:33:47.256Z","repository":{"id":62434720,"uuid":"72911247","full_name":"jackrusher/spicerack","owner":"jackrusher","description":"A Clojure wrapper for MapDB, which is a fast, disk-persistent data-structures library.","archived":false,"fork":false,"pushed_at":"2020-01-17T11:31:25.000Z","size":76,"stargazers_count":83,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-12-25T13:27:07.532Z","etag":null,"topics":["clojure","mapdb"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackrusher.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-05T07:18:37.000Z","updated_at":"2025-07-17T06:36:01.000Z","dependencies_parsed_at":"2022-11-01T21:02:05.854Z","dependency_job_id":null,"html_url":"https://github.com/jackrusher/spicerack","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jackrusher/spicerack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackrusher%2Fspicerack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackrusher%2Fspicerack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackrusher%2Fspicerack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackrusher%2Fspicerack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackrusher","download_url":"https://codeload.github.com/jackrusher/spicerack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackrusher%2Fspicerack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29537837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T08:11:05.436Z","status":"ssl_error","status_checked_at":"2026-02-17T08:09:38.860Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","mapdb"],"created_at":"2024-11-15T04:49:28.350Z","updated_at":"2026-02-17T08:33:47.239Z","avatar_url":"https://github.com/jackrusher.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"![The spicerack logo](https://cloud.githubusercontent.com/assets/220188/20091210/d20e41e6-a591-11e6-9411-94852705097b.png)\n\nSometimes, while making tasty computer programs, one needs a place to\nstore labeled containers of data. Spicerack is that kind of place.\n\nThis library is a Clojure wrapper for [MapDB](http://www.mapdb.org) —\na fast, disk-persistent data-structures library. Like many Clojure\nwrappers around Java libraries, this one is incomplete. MapDB supports\nseveral data structures (`Map`, `Set` and `List`, implemented with\ntrees and hashes), and can do fun things with them, like creating a\nhash table that acts as a cache with automatic eviction and change\nlisteners. This wrapper doesn't support any of that. It just provides\nan idiomatic way to store something like a Clojure `hash-map` on disk.\n\nI plan to add the other data types over time, as I need them for my\nown projects. In the meantime, these features are well-tested,\ndeployed in production, and quite useful.\n\n## Usage \n\n``` clojure\n[spicerack \"0.1.6\"]\n```\n\nThere are only a handful of functions in this wrapper. It provides\n`open-database` and `close` (though it's best to use clojure's\n`with-open` macro to handle closing), `assoc!`, `dissoc!`, and\n`update!` for mutation, on top of which `clojure.core`'s `get`\nfunction can be used to access the value of a given key.\n\n``` clojure\n(require '[spicerack.core :refer [open-database open-hashmap assoc! update!]])\n\n(with-open [db (open-database \"./baking-db\")]\n  (let [ingredients (open-hashmap db \"ingredient-hashmap\")]\n    (assoc! ingredients :apple-pie [:flour :butter :sugar :apples])\n    ;;=\u003e [:flour :butter :sugar :apples]\n    (update! ingredients :apple-pie conj :cinnamon)))\n    ;;=\u003e [:flour :butter :sugar :apples :cinnamon]\n```\n\nIn addition, Spicerack's `hash-map` implementation can be used like a\nnormal Clojure `hash-map` with sequence functions such as `map` and\n`reduce`:\n\n``` clojure\n(with-open [db (open-database test-filename)]\n  (let [hm (open-hashmap db \"test-hashmap\")]\n    (doseq [[a b] (map vector (range 10) (range 0 1.0 0.1))]\n      (assoc! hm a b))\n\n    (get hm 1)\n    ;;=\u003e 0.1\n\n    (get hm 47 :hi)\n    ;;=\u003e :hi\n\n    (reduce (fn [acc [k v]] (+ acc v)) 0 hm)\n    ;;=\u003e 4.5\n\n    (reduce (fn [acc [k v]] (+ acc k)) 0 hm)\n    ;;=\u003e 45\n\n    (mapv (fn [[k v]]\n            {:key k\n             :val v})\n          hm)\n    ;;=\u003e\n    [{:key 0, :val 0}\n     {:key 8, :val 0.7999999999999999}\n     {:key 5, :val 0.5}\n     {:key 3, :val 0.30000000000000004}\n     {:key 2, :val 0.2}\n     {:key 6, :val 0.6}\n     {:key 7, :val 0.7}\n     {:key 1, :val 0.1}\n     {:key 9, :val 0.8999999999999999}\n     {:key 4, :val 0.4}]))\n```\n\nNote that returning a lazy sequence from inside of a `with-open`\nblock, then trying to realize that sequence outside of the block, will\ncause an exception to be thrown.\n\nThere are more examples in the test suite. In additon, there is\nautomatically generated [codox](https://github.com/weavejester/codox)\nAPI documentation [here](https://jackrusher.github.io/spicerack/).\n\n## License \n\nCopyright © 2016-2019 Jack Rusher\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackrusher%2Fspicerack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackrusher%2Fspicerack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackrusher%2Fspicerack/lists"}