llegaz/redis-ultimate

Sets and MQ oparations for Redis

Maintainers

Package info

github.com/llegaz/RedisUltimate

pkg:composer/llegaz/redis-ultimate

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

0.1.1 2026-04-30 03:41 UTC

This package is not auto-updated.

Last update: 2026-04-30 04:08:37 UTC


README

PHP library for Redis sets, MQ, and more — ordered by priority.

1️⃣ Sets — Core Operations

sadd(string $key, mixed ...$members): int      // Add one or more members
srem(string $key, mixed ...$members): int      // Remove one or more members
smembers(string $key): array                   // Return all members
sismember(string $key, mixed $member): bool    // Check if a member exists
scard(string $key): int                        // Count members

2️⃣ Sets — Inter-set Operations

sinter(string ...$keys): array                 // Intersection
sunion(string ...$keys): array                 // Union
sdiff(string $key, string ...$keys): array     // Difference

3️⃣ Lists — Basic MQ

rpush(string $key, mixed ...$values): int      // Producer: push a message
lpop(string $key): mixed                       // Non-blocking consumer
lmpop(string $key): array
llen(string $key): int                         // Queue length

Classic pattern

Producer  →  LPUSH queue "message"
Consumer  →  BRPOP queue 0       // blocks until a message arrives

6️⃣ Pub/Sub

publish(string $channel, mixed $message): int          // Publish a message
subscribe(string ...$channels): void                   // Subscribe to channels
unsubscribe(string ...$channels): void                 // Unsubscribe
psubscribe(string ...$patterns): void                  // Pattern matching e.g. "user.*"

7️⃣ Streams — The Final Boss (proper MQ)

// * = auto-generated id
xadd(string $key, array $message, string $id = '*'): string

// Simple read
xread(array $streams, int $count = null, int $block = null): array

// Read via consumer group
xreadgroup(string $group, string $consumer, array $streams, int $count = null): array

// Acknowledge a processed message
xack(string $key, string $group, string ...$ids): int

// Manage consumer groups
xgroup(string $op, string $key, string $group, string $id = '0'): mixed

// Number of messages in the stream
xlen(string $key): int

Lists → simple, no ack, fire & forget
Streams → persistent, ack, consumer groups, replayable ← Kafka-like

@See you space cowboy... 🚀