(require '[boundary.cache.shell.adapters.in-memory :as in-mem]
'[boundary.cache.ports :as ports])
;; Create in-memory cache
(def cache (in-mem/create-in-memory-cache {:max-size 1000 :track-stats? true}))
;; Basic operations
(ports/set-value! cache :user-123 {:name "Alice"} 3600) ; TTL in seconds
(ports/get-value cache :user-123)
(ports/delete-value! cache :user-123)
;; Atomic operations
(ports/increment! cache :counter)
(ports/set-if-absent! cache :lock "holder-id" 30) ; SETNX pattern
;; Tenant-scoped cache
(require '[boundary.cache.shell.tenant-cache :as tenant-cache])
(def tenant-cache (tenant-cache/create-tenant-cache cache "acme-corp"))
;; Keys automatically prefixed: "tenant:acme-corp:user-123"