llegaz/redis-ultimate
Composer 安装命令:
composer require llegaz/redis-ultimate
包简介
Sets and MQ oparations for Redis
关键字:
README 文档
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️⃣ Zsets- sorted sets
zadd(string $key, mixed ...$members): int // Add one or more members zrem(string $key, mixed ...$members): int // Remove one or more members zrange(string $key): array // Return all members zcard(string $key): int // Count members
4️⃣ 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... 🚀
统计信息
- 总下载量: 180
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-29