Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defrecord BasicWelleCache [^String bucket ^String content-type ^Integer w])
- (extend-protocol cache/CacheProtocol
- BasicWelleCache
- (lookup [c k]
- (:value (kv/fetch-one (.bucket c) k)))
- (has? [c k]
- (not (empty? (kv/fetch (.bucket c) k :head-only true))))
- (hit [this k]
- this)
- (miss [c k v]
- (kv/store (.bucket c) k v :content-type (.content-type c) :w (.w c))
- c)
- (evict [c k]
- (kv/delete (.bucket c) k :w (.w c))
- c)
- (seed [c m]
- (doseq [[k v] m]
- (kv/store (.bucket c) k v :content-type (.content-type c) :w (.w c)))
- c))
Add Comment
Please, Sign In to add comment