budtags/skills/redis/SKILL.md
Comprehensive Redis 7.x reference with BudTags-specific patterns. Covers all commands, data types, persistence, memory optimization, performance tuning, high availability, security, and Laravel integration.
npx skillsauth add jwilly246/budtags-claude-plugin redisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are now equipped with comprehensive knowledge of Redis caching patterns and best practices in the BudTags codebase. This skill uses progressive disclosure to load only the patterns relevant to your current task.
When this skill is active, you can:
This skill provides comprehensive Redis 7.x documentation organized into 10 categories with 58 reference files:
patterns/cache-facade.md - Laravel Cache facade operations (get, put, remember, forever)patterns/redis-facade.md - Low-level Redis facade operations (sadd, smembers, incr, del)patterns/key-naming.md - BudTags key naming conventions (CRITICAL for consistency)patterns/ttl-strategy.md - When to use forever vs TTL, decision guidepatterns/distributed-locks.md - Cache::lock patterns for concurrent operationspatterns/rate-limiting.md - Sliding window rate limiting from MetrcApiscenarios/caching-api-responses.md - fetch_from_cache_or_api pattern (MOST COMMON)scenarios/bulk-cache-operations.md - Package chunking, cache rebuild strategiesscenarios/atomic-counters.md - Progress tracking with Redis::incrscenarios/pattern-based-deletion.md - DevController patterns for cache managementdocs/commands/index.md - Command categories overview and quick referencedocs/commands/strings.md - GET, SET, INCR, APPEND, GETRANGE, etc.docs/commands/hashes.md - HGET, HSET, HMGET, HINCRBY, HSCAN, etc.docs/commands/lists.md - LPUSH, RPUSH, LPOP, LRANGE, LINDEX, etc.docs/commands/sets.md - SADD, SMEMBERS, SINTER, SUNION, SDIFF, etc.docs/commands/sorted-sets.md - ZADD, ZRANGE, ZRANK, ZSCORE, ZINCRBY, etc.docs/commands/keys.md - KEYS, SCAN, EXISTS, DEL, EXPIRE, TTL, etc.docs/commands/server.md - INFO, CONFIG, DBSIZE, FLUSHDB, DEBUG, etc.docs/commands/transactions.md - MULTI, EXEC, DISCARD, WATCH patternsdocs/commands/scripting.md - EVAL, EVALSHA, Lua scripting patternsdocs/commands/pub-sub.md - PUBLISH, SUBSCRIBE, PSUBSCRIBE patternsdocs/commands/streams.md - XADD, XREAD, XREADGROUP, consumer groupsdocs/commands/geo.md - GEOADD, GEODIST, GEORADIUS, geospatial queriesdocs/commands/hyperloglog.md - PFADD, PFCOUNT, cardinality estimationdocs/commands/bitmaps.md - SETBIT, GETBIT, BITCOUNT, BITOP patternsdocs/commands/cluster.md - CLUSTER commands, slot managementdocs/data-types/index.md - Type selection guide and comparisonsdocs/data-types/strings.md - Binary-safe strings, counters, serializationdocs/data-types/hashes.md - Field-value maps, object storagedocs/data-types/lists.md - Ordered collections, queues, stacksdocs/data-types/sets.md - Unique collections, intersections, unionsdocs/data-types/sorted-sets.md - Scored sets, leaderboards, time seriesdocs/data-types/streams.md - Append-only logs, consumer groupsdocs/data-types/geospatial.md - Location data, proximity queriesdocs/data-types/bitmaps.md - Bit-level operations, feature flagsdocs/data-types/hyperloglogs.md - Probabilistic cardinalitydocs/persistence/index.md - Persistence strategies overviewdocs/persistence/rdb.md - Point-in-time snapshots, BGSAVEdocs/persistence/aof.md - Append-only file, fsync policiesdocs/persistence/hybrid.md - RDB+AOF combination strategiesdocs/memory/index.md - Memory architecture and analysisdocs/memory/data-encoding.md - Internal encodings, memory savingsdocs/memory/eviction-policies.md - LRU, LFU, volatile-, allkeys-docs/memory/key-expiration.md - TTL strategies, lazy vs active expirydocs/memory/memory-doctor.md - Diagnostics and optimizationdocs/performance/index.md - Performance fundamentalsdocs/performance/pipelining.md - Batch commands, reduce RTTdocs/performance/connection-pooling.md - Pool management, sizingdocs/performance/slow-commands.md - Identify and fix slow operationsdocs/performance/benchmarking.md - redis-benchmark, load testingdocs/performance/latency.md - Latency diagnosis, optimizationdocs/high-availability/index.md - HA architecture overviewdocs/high-availability/replication.md - Master-replica, REPLICAOFdocs/high-availability/sentinel.md - Automatic failover, monitoringdocs/high-availability/cluster.md - Sharding, hash slots, scalingdocs/security/index.md - Security overview and checklistdocs/security/authentication.md - ACLs, users, passwordsdocs/security/network.md - Binding, firewalls, TLSdocs/security/commands.md - Command restrictions, dangerous commandsdocs/advanced/index.md - Advanced features overviewdocs/advanced/lua-scripting.md - EVAL, atomicity, script patternsdocs/advanced/transactions.md - MULTI/EXEC, optimistic lockingdocs/advanced/pub-sub.md - Real-time messaging patternsdocs/advanced/client-caching.md - Client-side caching, invalidationdocs/advanced/modules.md - RedisJSON, RediSearch, RedisGraphdocs/configuration/index.md - Configuration file referencedocs/configuration/redis-conf.md - redis.conf directivesdocs/configuration/runtime-config.md - CONFIG GET/SET, live tuningdocs/laravel-integration.md - How Laravel wraps Redis (Cache vs Redis facades)| DB | Purpose | Connection | Default |
|----|---------|------------|---------|
| 0 | Default (sessions, etc.) | default | REDIS_DB |
| 1 | Cache | cache | REDIS_CACHE_DB |
| 2 | Queues (Horizon) | queue | REDIS_QUEUE_DB |
| Pattern | Example | TTL | Use Case |
|---------|---------|-----|----------|
| metrc:{entity}:{id} | metrc:package:ABC123 | forever | Single cached item |
| metrc:day-of-{entity}:{license}:{date} | metrc:day-of-packages:AU-P-123:1/15/2025 | forever | Day-partitioned lists |
| metrc:{entity}-available-tags:{license} | metrc:package-available-tags:AU-P-123 | 2 min | Fast-changing data |
| metrc:{entity}:{license} | metrc:locations:AU-P-123 | 30 days | Stable reference data |
| org:{org_id}:{feature} | org:abc-123:transfer_selections | 30 days | Org-scoped user data |
| {feature}:{id} | label_group_success:42 | 1 hour | Temporary counters |
const DEFAULT_CACHE_TIME = null; // Permanent (Cache::forever)
const INACTIVE_CACHE_TIME = 60*60*24*30; // 30 days (inactive/historical)
const PLANT_CACHE_TIME = null; // Permanent for active plants
| Value | Duration | Use Case |
|-------|----------|----------|
| null | Forever | Active packages, plants, core entity data |
| 120 | 2 min | Tags, strains, employees (fast-changing) |
| 600 | 10 min | Adjustments (immutable once fetched) |
| 3600 | 1 hour | Counters, temporary tracking |
| 43200 | 12 hours | Items, full package lists |
| 60*60*24*7 | 7 days | Transfer deliveries, transporter details |
| 60*60*24*30 | 30 days | Inactive packages, historical data |
// ✅ CORRECT - Include org_id for org-specific data
$key = "org:{$org_id}:transfer_selections";
Cache::put($key, $data, now()->addDays(30));
// ❌ WRONG - Unscoped key allows cross-tenant data access
$key = "transfer_selections"; // Security vulnerability!
// ✅ Use Cache:: for standard get/put/remember
Cache::forever("metrc:package:{$label}", $data);
Cache::remember($key, 3600, fn() => $this->fetchData());
// ✅ Use Redis:: for atomic operations and data structures
Redis::incr("label_group_success:{$id}");
Redis::sadd("metrc:package-labels:{$facility}", ...$labels);
Redis::smembers("metrc:package-labels:{$facility}");
// ✅ Use Redis::command for low-level operations
Redis::command('select', [1]); // Switch to cache DB
Redis::command('keys', ['*pattern*']); // Pattern search
Redis::command('dbsize'); // Count keys
// When using Redis:: directly for cache operations, select DB 1 first
Redis::command('select', [1]);
$keys = Redis::command('keys', ['*day-of-packages*']);
// Today's data should always be force-fetched
$packages = $this->fetch_from_cache_or_api(
$cache_key,
fn() => $this->fetchFromApi(),
null,
$force_fetch || $start_day->isToday(), // ✅ Force if today
self::DEFAULT_CACHE_TIME,
);
| Operation | Invalidate | |-----------|------------| | Create package | Tags cache, today's package cache | | Finish package | Active + inactive package caches | | Move/adjust package | No invalidation (lastModified handles) | | Create/update item | Items cache | | Harvest plant | Plant caches, harvest caches |
Before committing caching code, verify:
patterns/cache-facade.md + patterns/key-naming.md + scenarios/caching-api-responses.mdpatterns/redis-facade.md + scenarios/atomic-counters.mdpatterns/cache-facade.md + patterns/ttl-strategy.md + scenarios/bulk-cache-operations.mdpatterns/redis-facade.md + scenarios/pattern-based-deletion.mdpatterns/rate-limiting.mddocs/data-types/index.md → specific type file → docs/commands/{type}.mddocs/performance/index.md → specific topic (pipelining, slow-commands, latency)docs/memory/index.md → docs/memory/eviction-policies.md or docs/memory/memory-doctor.mddocs/persistence/index.md → docs/persistence/rdb.md or docs/persistence/aof.mddocs/security/index.md → specific topic (authentication, network, commands)docs/high-availability/index.md → replication, sentinel, or clusterdocs/advanced/lua-scripting.mddocs/advanced/transactions.mddocs/advanced/pub-sub.mddocs/advanced/client-caching.mdHelp users master Redis in the BudTags codebase by:
You are a Redis expert with comprehensive knowledge of both Redis internals and BudTags-specific patterns!
development
Use this skill when generating ZPL code, working with ZPL commands, creating Zebra printer labels, or troubleshooting ZPL syntax and formatting issues.
development
Use this skill to verify that code aligns with BudTags coding standards, architectural patterns, and conventions before or after implementation.
development
Use this skill when working with Unleashed Software inventory/order management API integration, syncing inventory, importing orders, managing stock adjustments, or handling customer/product data from Unleashed.
data-ai
TanStack Virtual patterns for virtualized lists, tables, and grids with high-performance rendering of large datasets