mirror of
https://github.com/status-im/timbre.git
synced 2025-02-19 15:14:12 +00:00
Mod Carmine appender to work correctly with Carmine v3+
This commit is contained in:
parent
f8ab8abc42
commit
338ac0497d
@ -1,8 +1,11 @@
|
|||||||
|
## v3.1.2 / 2014 Mar 9
|
||||||
|
|
||||||
|
* FIX: Carmine appender unfreezable support for Carmine v3+.
|
||||||
|
|
||||||
|
|
||||||
## v3.1.1 / 2014 Feb 26
|
## v3.1.1 / 2014 Feb 26
|
||||||
|
|
||||||
### Fixes
|
* FIX: project.clj to prevent unnecessary downstream deps.
|
||||||
|
|
||||||
* Fix project.clj to prevent unnecessary downstream deps.
|
|
||||||
|
|
||||||
|
|
||||||
## v3.1.0 / 2014 Feb 23
|
## v3.1.0 / 2014 Feb 23
|
||||||
|
@ -59,29 +59,30 @@
|
|||||||
nmax-entries (nentries-by-level level)]
|
nmax-entries (nentries-by-level level)]
|
||||||
|
|
||||||
(when (> nmax-entries 0)
|
(when (> nmax-entries 0)
|
||||||
(car/wcar (or conn-opts (:conn opts)) ; :conn is Deprecated
|
(binding [nippy/*final-freeze-fallback* nippy/freeze-fallback-as-str]
|
||||||
(binding [nippy/*final-freeze-fallback* nippy/freeze-fallback-as-str]
|
(car/wcar (or conn-opts (:conn opts)) ; :conn is Deprecated
|
||||||
(car/hset k-hash entry-hash entry))
|
|
||||||
(car/zadd k-zset udt entry-hash)
|
|
||||||
|
|
||||||
(when (< (rand) 0.01) ; Occasionally GC
|
(car/hset k-hash entry-hash entry)
|
||||||
;; This is necessary since we're doing zset->entry-hash->entry
|
(car/zadd k-zset udt entry-hash)
|
||||||
;; rather than zset->entry. We want the former for the control
|
|
||||||
;; it gives us over what should constitute a 'unique' entry.
|
|
||||||
(car/lua
|
|
||||||
"-- -ive idx used to prune from the right (lowest score first)
|
|
||||||
local max_idx = (0 - (tonumber(_:nmax-entries)) - 1)
|
|
||||||
local entries_to_prune =
|
|
||||||
redis.call('zrange', _:k-zset, 0, max_idx)
|
|
||||||
redis.call('zremrangebyrank', _:k-zset, 0, max_idx) -- Prune zset
|
|
||||||
|
|
||||||
for i,entry in pairs(entries_to_prune) do
|
(when (< (rand) 0.01) ; Occasionally GC
|
||||||
redis.call('hdel', _:k-hash, entry) -- Prune hash
|
;; This is necessary since we're doing zset->entry-hash->entry
|
||||||
end
|
;; rather than zset->entry. We want the former for the control
|
||||||
return nil"
|
;; it gives us over what should constitute a 'unique' entry.
|
||||||
{:k-zset k-zset
|
(car/lua
|
||||||
:k-hash k-hash}
|
"-- -ive idx used to prune from the right (lowest score first)
|
||||||
{:nmax-entries nmax-entries}))))))})))
|
local max_idx = (0 - (tonumber(_:nmax-entries)) - 1)
|
||||||
|
local entries_to_prune =
|
||||||
|
redis.call('zrange', _:k-zset, 0, max_idx)
|
||||||
|
redis.call('zremrangebyrank', _:k-zset, 0, max_idx) -- Prune zset
|
||||||
|
|
||||||
|
for i,entry in pairs(entries_to_prune) do
|
||||||
|
redis.call('hdel', _:k-hash, entry) -- Prune hash
|
||||||
|
end
|
||||||
|
return nil"
|
||||||
|
{:k-zset k-zset
|
||||||
|
:k-hash k-hash}
|
||||||
|
{:nmax-entries nmax-entries})))))))})))
|
||||||
|
|
||||||
;;;; Query utils
|
;;;; Query utils
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user