Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

llegaz/RedisUltimate

Open more actions menu

Repository files navigation

🔴 RedisUltimate — Implementation Roadmap

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... 🚀

About

SET, ZSET and MQ based on Redis

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.