commands library

The redis:* commands (redis:ping, redis:stats, redis:keys-audit, redis:cli), for bootstrap/commands.dart:

import 'package:daravel_redis/commands.dart';

final List<CommandFactory> commands = [...redisCommands];

A library of its own, so the server does not compile the CLI it needs.

Classes

CachePruneStaleTagsCommand
cache:prune-stale-tags [--store=redis]: drops expired keys from the tag lists of a Redis cache store (Laravel's command of the same name).
RedisCliCommand
redis:cli [--connection=default] [--write] [command ...]: one command, or a prompt reading commands until quit. Only reading commands run unless --write is given.
RedisInspectCommand
redis:inspect <key> [--connection=default]: what a key holds. Its tool redis_inspect gives AI agents the same through mcp:serve; values stay hidden when APP_ENV=production.
RedisKeysAuditCommand
redis:keys-audit [--connection=cache] [--match=...] [--limit=20]: keys by type under the application's prefix, and cache keys without a time to live (they stay until deleted).
RedisPingCommand
redis:ping [--connection=default]: the server, its version, the mode and the round trip.
RedisStatsCommand
redis:stats [--connection=default]: what this client did, and what each master reports (INFO).

Constants

redisCommands → const List<CommandFactory>
The redis:* commands, for bootstrap/commands.dart:
redisReadCommands → const Set<String>
Commands redis:cli runs without --write: those that only read (KEYS is left out: it blocks the server on a large database, SCAN does not).

Functions

auditRedisKeys(RedisClient client, {required String match, required String cachePrefix, int limit = 20}) → Future<RedisKeysAudit>
Every key matching match (on every master), counted by type, and the keys under cachePrefix that never expire, at most limit of them: what a cache that only grows looks like.
formatRedisReply(Object? reply, [String indent = '']) → String
A reply as redis-cli prints it.
inspectRedisKey(RedisClient client, String key, {bool values = true, int limit = 20}) → Future<Map<String, Object?>>
What one key holds: its type, time to live, encoding, size and memory, and with values the first limit items (a string's first 1000 characters). Null fields where the server does not say.
isReadOnlyRedisCommand(List<String> args) → bool
Whether args only reads.
parseRedisCommandLine(String line) → List<String>
A command line split as redis-cli does: on spaces, with "..." and '...' quoting (backslash escapes inside double quotes).
parseRedisInfo(Object? info) → Map<String, String>
The fields of an INFO reply.

Typedefs

RedisKeysAudit = ({List<String> cacheWithoutTtl, int keys, Map<String, int> types, int withoutTtl})
What auditRedisKeys found.