Unified multimethod-based store dispatch layer.
This namespace provides a polymorphic interface for connecting to different
konserve backend stores using a :backend key in the configuration map.
Built-in backends:
External backends (register via require):
Example usage:
(require '[konserve.store :as store])
;; Memory store (store/connect-store {:backend :memory :opts {:sync? true}})
;; File store (JVM) (store/connect-store {:backend :file :path "/tmp/konserve" :opts {:sync? true}})
;; After requiring konserve-s3: (store/connect-store {:backend :s3 :bucket "my-bucket" :region "us-east-1"})
Unified multimethod-based store dispatch layer.
This namespace provides a polymorphic interface for connecting to different
konserve backend stores using a `:backend` key in the configuration map.
Built-in backends:
- :memory - In-memory store (all platforms)
- :file - File-based store (JVM only)
- :tiered - Tiered store with frontend cache and backend persistence (all platforms)
External backends (register via require):
- :file - File-based store for Node.js (konserve.node-filestore)
- :indexeddb - Browser IndexedDB (konserve.indexeddb - browser only)
- :s3 - AWS S3 backend (konserve-s3)
- :dynamodb - AWS DynamoDB backend (konserve-dynamodb)
- :redis - Redis backend (konserve-redis)
- :lmdb - LMDB backend (konserve-lmdb)
- :rocksdb - RocksDB backend (konserve-rocksdb)
Example usage:
(require '[konserve.store :as store])
;; Memory store
(store/connect-store {:backend :memory :opts {:sync? true}})
;; File store (JVM)
(store/connect-store {:backend :file :path "/tmp/konserve" :opts {:sync? true}})
;; After requiring konserve-s3:
(store/connect-store {:backend :s3 :bucket "my-bucket" :region "us-east-1"})Private multimethod for connecting to stores with fixed arity.
Dispatch is based on :backend in config.
Private multimethod for connecting to stores with fixed arity. Dispatch is based on :backend in config.
Private multimethod for creating stores with fixed arity.
Dispatch is based on :backend in config.
Private multimethod for creating stores with fixed arity. Dispatch is based on :backend in config.
Private multimethod for deleting stores with fixed arity.
Dispatch is based on :backend in config.
Private multimethod for deleting stores with fixed arity. Dispatch is based on :backend in config.
Private multimethod for releasing stores with fixed arity.
Dispatch is based on :backend in config.
Private multimethod for releasing stores with fixed arity. Dispatch is based on :backend in config.
Private multimethod for checking store existence with fixed arity.
Dispatch is based on :backend in config.
Private multimethod for checking store existence with fixed arity. Dispatch is based on :backend in config.
(connect-store config)(connect-store config opts)Connect to a konserve store based on :backend key in config.
Each backend expects different config keys. See documentation for specific backend configuration requirements.
Args: config - A map with :backend key and backend-specific configuration opts - (optional) Runtime options map. Defaults to {:sync? false} Common options: - :sync? - true for synchronous, false for async (default: false)
Returns: A store instance (or channel if async mode)
Connect to a konserve store based on :backend key in config.
Each backend expects different config keys. See documentation for specific backend
configuration requirements.
Args:
config - A map with :backend key and backend-specific configuration
opts - (optional) Runtime options map. Defaults to {:sync? false}
Common options:
- :sync? - true for synchronous, false for async (default: false)
Returns:
A store instance (or channel if async mode)(create-store config)(create-store config opts)Create a new store.
Note: Most backends auto-create on connect-store, so this is often equivalent. Use this when you explicitly want to create a new store.
Args: config - A map with :backend key and backend-specific configuration opts - (optional) Runtime options map. Defaults to {:sync? false}
Returns: A new store instance
Create a new store.
Note: Most backends auto-create on connect-store, so this is often equivalent.
Use this when you explicitly want to create a new store.
Args:
config - A map with :backend key and backend-specific configuration
opts - (optional) Runtime options map. Defaults to {:sync? false}
Returns:
A new store instance(delete-store config)(delete-store config opts)Delete/clean up an existing store (removes underlying storage).
Args: config - A map with :backend key and backend-specific configuration opts - (optional) Runtime options map. Defaults to {:sync? false}
Returns: nil or cleanup status
Delete/clean up an existing store (removes underlying storage).
Args:
config - A map with :backend key and backend-specific configuration
opts - (optional) Runtime options map. Defaults to {:sync? false}
Returns:
nil or cleanup status(release-store config store)(release-store config store opts)Release connections and resources held by a store.
Args: config - A map with :backend key store - The store instance to release opts - (optional) Runtime options map. Defaults to {:sync? false}
Returns: nil or completion indicator
Release connections and resources held by a store.
Args:
config - A map with :backend key
store - The store instance to release
opts - (optional) Runtime options map. Defaults to {:sync? false}
Returns:
nil or completion indicator(store-exists? config)(store-exists? config opts)Check if a store exists at the given configuration.
Args: config - A map with :backend key and backend-specific configuration opts - (optional) Runtime options map. Defaults to {:sync? false}
Returns: true if store exists, false otherwise (or channel in async mode)
Check if a store exists at the given configuration.
Args:
config - A map with :backend key and backend-specific configuration
opts - (optional) Runtime options map. Defaults to {:sync? false}
Returns:
true if store exists, false otherwise (or channel in async mode)(validate-store-config config)Validates that store config has a valid UUID :id.
All stores require an :id field containing a UUID type for proper identification and matching across different backends and machines.
Args: config - Store configuration map
Returns: config if valid
Throws: ex-info if :id is missing or not a UUID type
Validates that store config has a valid UUID :id. All stores require an :id field containing a UUID type for proper identification and matching across different backends and machines. Args: config - Store configuration map Returns: config if valid Throws: ex-info if :id is missing or not a UUID type
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |