feat: v0.1.0 - sets, counters, TTL introspection, list ops + memory-mode TTL fixes#11
Merged
Conversation
…l-types fix - New commands on IRedisAdapter + both adapters: sadd/srem/smembers/ sismember/scard, incr/decr/incrby/hincrby, ttl/pttl, lpush/lpop/ rpop/llen, mget, zscore/zrem/zrangebyscore, set with EX/PX options. - Memory-mode TTL refactor: one expirations map covers every key type (expire/pexpire previously no-oped on hashes/lists/zsets); reads lazily evict; sweep covers all stores; emptied collections delete the key and its TTL like real Redis. - keys() scans every store, not just strings; del/exists cover sets. - lrange/zrange handle negative indexes properly; zremrangebyscore no longer turns '(5' into NaN-removes-everything (shared bound parser with -inf/+inf and exclusive bounds, throws on garbage). - IoRedisAdapter.duplicate() no longer constructs a throwaway Redis instance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Grows the surface from "cache + pub/sub + rate limit" to most of the day-to-day Redis command set, and makes memory-mode TTL handling correct for every key type. Ships the v0.1.0 bump, so merging this auto-releases to npm.
Added
sadd/srem/smembers/sismember/scardincr/decr/incrby/hincrby(memory mode counts missing keys from 0, throws Redis's "value is not an integer or out of range" on non-integer values)ttl(-2 / -1 sentinels, seconds rounded up) andpttllpush/lpop/rpop/llen; popping the last element deletes the key like real Redismget,zscore(score as string, matching ioredis),zrem,zrangebyscore(-inf/+inf+ exclusive(nbounds)setaccepts trailingEX <seconds>/PX <ms>; memory mode throws on unsupported option tokens (NX/XX/KEEPTTL) instead of silently diverging from ioredis modeFixed
expire/pexpirenow work on every key type in memory mode — TTLs moved to a single expirations map covering strings, hashes, lists, sets, and zsets (previously they silently no-oped on anything that wasn't a plain string). Reads lazily evict; the sweep covers all stores; emptied collections drop the key and its TTL.keys(pattern)scans every store (only saw string keys before);del/existscover sets.lrange/zrangehandle negative indexes properly (onlystop === -1was special-cased).zremrangebyscoreno longer turns'(5'into NaN — which used to remove every member; the shared bound parser rejects malformed bounds loudly.set(key, value)clears an existing TTL (Redis semantics — no implicit KEEPTTL).Changed
IoRedisAdapter.duplicate()no longer constructs a throwawayRedisinstance.Tests
36/36 (was 20) — sets, counters + non-integer throw, ttl/pttl incl. real-time pexpire expiry, expire-on-hash/list/zset/set, set EX/PX + unsupported-option throw + TTL-clear, negative-index ranges, exclusive-bound regression, mget with gaps, duplicate() sharing the new stores.