Skip to content

v1.1.2

Choose a tag to compare

@joshdougall joshdougall released this 14 Aug 14:56
· 44 commits to main since this release
v1.1.2
1ad79d9

Makes memory_get atomic.

memory_get read the entry, checked it existed, then incremented hits in a
separate round trip. If the entry was deleted or its TTL expired in that
gap, HINCRBY recreated the missing key, leaving a mem: hash with only
hits, no title and no TTL. Because existence is defined by the title field
everywhere else, such a key was invisible to memory_get, memory_list,
memory_delete and prune_candidates, while the mem:* scan still counted it
toward memory_entries_total and the soft-cap warning. Nothing in the API
could remove it.

memory_get is now a single Lua EVAL that returns not_found when there is no
title and only increments otherwise, closing the window by construction and
dropping the call from two round trips to one.

The response also reports the value HINCRBY returned rather than
synthesising read + 1, which was wrong under concurrent reads: ten
simultaneous callers all reported hits 1 while the stored counter reached
ten.

Present in 1.0.0 through 1.1.1. Tracked as Forgejo issue #1.

47 tests passing, lint clean.