Skip to content

feat(cacher): Redis cacher production-ready + 16 integration tests - #42

Merged
explosivebit merged 1 commit into
devfrom
feat/redis-cacher-production
Apr 7, 2026
Merged

explosivebit merged 1 commit into
devfrom
feat/redis-cacher-production

Conversation

@explosivebit

Copy link
Copy Markdown
Contributor

Summary

Redis cacher was 90% implemented but never actually connectedstart()/stop() were no-ops inherited from base class. This PR fixes the lifecycle and adds comprehensive integration tests.

Changes

Change Details
start() Calls connect() — establishes Redis connection
stop() Calls disconnect() — graceful cleanup
init() Resets connected=False (base sets True, wrong for network cachers)
16 tests Unit + integration with real Redis on localhost:6381

Integration Tests

  • start/stop lifecycle
  • get/set/delete/clean
  • TTL expiration (1s sleep)
  • Pattern cleanup (user:* vs order:*)
  • get_with_ttl (pipeline)
  • get_cache_keys (SCAN)
  • Complex nested structures
  • Full broker integration (cached action)

Evidence

Step Result
ruff + mypy ✅ 0 errors
pytest ✅ 2371 passed
Redis integration ✅ 16/16 pass

🤖 Generated with Claude Code

…integration tests

Fixes P0 gap: RedisCacher.start()/stop() now properly connect/disconnect.
Broker calls these during lifecycle — previously they were no-ops, meaning
Redis cacher was never actually connected.

Changes:
- start() → calls connect() (establishes Redis connection)
- stop() → calls disconnect() (graceful cleanup)
- init() resets connected=False (base sets True, wrong for network cachers)
- 16 integration tests with real Redis (get/set/delete/clean/ttl/keys/broker)

Evidence: 2371 tests pass, mypy 0, demo 28/28.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Apr 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
moleculerpy/cacher/redis.py 50.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@explosivebit
explosivebit merged commit a5c1150 into dev Apr 7, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant