Skip to content

v1.0.7 — Redis Simulation Layer & Queue-Lock Stability Enhancements

Choose a tag to compare

@Maatify Maatify released this 18 Nov 09:54
· 7 commits to main since this release

📦 v1.0.7 — Redis Simulation Layer & Deterministic Locking Stability

Release Date: 2025-11-18

Author: Mohamed Abdulalim (megyptm) — Maatify.dev


🧩 Overview

This release introduces a fully simulated Redis environment for internal testing and brings major improvements to the HybridLockManager and queue-mode locking flows.

maatify/common now ships with a robust FakeRedisConnection that behaves like a real Redis server—supporting NX/EX locking, TTL expiration, and atomic delete operations.
This makes the entire locking system more stable, predictable, and testable, especially under concurrent resource scenarios.


✨ Highlights

✔ New Redis Simulation Layer

  • Added FakeRedisConnection:
    A Redis-compatible, in-memory driver supporting:

    • SET with NX + EX
    • TTL expiration
    • Atomic del
    • exists() with real expiration cleanup
  • Used automatically by FakeHealthyAdapter.

✔ Deterministic Queue-Mode Behavior

  • Queue-mode locking now respects TTL timing precisely.
  • Tests verify correct waiting intervals before acquiring the lock.
  • Eliminated microsecond flakiness across PHP versions.

✔ LockManager Improvements

  • HybridLockManager::waitAndAcquire() now fully synchronized with TTL-based expiration.
  • RedisLockManager now uses method-based detection of Redis-like clients instead of strict type checks.

✔ Test Suite Upgrades

  • Updated HybridLockManagerTest for accurate timing tests.
  • Fully deterministic queue-lock behavior.
  • Zero flakiness on PHP 8.4.

🛠 Changes

  • Added Redis simulation layer (FakeRedisConnection)
  • Updated FakeHealthyAdapter with full Redis-like behavior
  • Improved TTL and wait-loop logic in HybridLockManager
  • Adjusted RedisLockManager validation guard for mock compatibility
  • Updated queue-mode timing tests for stability

🧪 Test Results

  • 66 tests
  • 150 assertions
  • ≈ 98% coverage

All tests passed successfully.


✔ Compatibility

  • Full backward compatibility
  • No API changes
  • Safe update for all downstream libraries (data-adapters, rate-limiter, etc.)

🚀 Summary

v1.0.7 strengthens Maatify’s locking infrastructure, stabilizes concurrent execution flows, and introduces true Redis-like behavior for internal tests—without requiring a real Redis server.

This prepares the ecosystem for future distributed-locking enhancements and queue execution features.