Tiered store implementation with frontend and backend storage layers.
Tiered store implementation with frontend and backend storage layers.
(connect-tiered-store frontend-store
backend-store
&
{:keys [write-policy read-policy opts]
:or {write-policy :write-through
read-policy :frontend-first
opts {:sync? false}}
:as params})Create a tiered store with frontend and backend stores.
The backend store is the authoritative source of truth for durability. The frontend store acts as a performance cache layer.
Options:
Write policies:
Read policies:
Create a tiered store with frontend and backend stores.
The backend store is the authoritative source of truth for durability.
The frontend store acts as a performance cache layer.
Options:
- :write-policy #{:write-through :write-behind :write-around} (default :write-through)
- :read-policy #{:frontend-first :frontend-only} (default :frontend-first)
- :sync? Boolean for synchronous/asynchronous operation (default false)
Write policies:
- :write-through Write to backend, then frontend synchronously (strong consistency)
- :write-behind Write to frontend first, backend asynchronously (low latency, eventual durability)
- :write-around Write only to backend, invalidate frontend (bypass cache)
Read policies:
- :frontend-first Check frontend first, fallback to backend (populates frontend)
- :frontend-only Only read from frontend.(full-sync-strategy _frontend-keys backend-keys)Sync strategy that replaces entire frontend with backend.
Sync strategy that replaces entire frontend with backend.
(perform-sync frontend-store backend-store sync-strategy opts)Perform synchronization between frontend and backend stores.
Perform synchronization between frontend and backend stores.
(perform-walk-sync frontend-store backend-store root-keys walk-fn opts)Sync by walking from root key(s) and discovering reachable keys.
Arguments:
Returns a channel with {:synced-keys count :root-keys count}
This is useful for tree-structured data where you want to sync only reachable nodes rather than all keys in the store.
Sync by walking from root key(s) and discovering reachable keys.
Arguments:
- frontend-store: The frontend (fast) store to sync to
- backend-store: The backend (durable) store to sync from
- root-keys: Collection of root keys to fetch and walk from
- walk-fn: (fn [backend-store root-values opts] -> channel-of-keys)
Given the root values, discovers all reachable keys asynchronously.
Should return a core.async channel that yields the set of keys to sync.
- opts: Options map, :sync? should be false for async backends
Returns a channel with {:synced-keys count :root-keys count}
This is useful for tree-structured data where you want to sync only
reachable nodes rather than all keys in the store.(populate-missing-strategy frontend-keys backend-keys)Sync strategy that only adds keys missing from frontend.
Sync strategy that only adds keys missing from frontend.
(sync-keys-to-frontend! frontend-store backend-store keys-to-sync opts)Public API for syncing specific keys from backend to frontend. Used by walk-based sync strategies that discover keys externally.
Public API for syncing specific keys from backend to frontend. Used by walk-based sync strategies that discover keys externally.
(sync-on-connect {:keys [frontend-store backend-store]} sync-strategy opts)Optionally perform sync when connecting to store.
Optionally perform sync when connecting to store.
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 |