Myxa logo

Myxa

Version: 1.0.6

A lightweight, AI-powered PHP framework for teams that want to build modern systems fast without giving up clarity, performance, or developer joy.

Myxa is designed around recent PHP practices: strict typing, explicit structure, container-driven architecture, fast backend execution, and a developer experience that feels approachable whether you stay server-rendered or grow into a hybrid frontend.

Documentation

Cache

The app wires the framework cache manager through App\Providers\CacheServiceProvider and config/cache.php.

Use cache for short-lived computed values, lookup results, or other data that can be safely rebuilt.

Configuration

Cache config lives in:

config/cache.php

The default cache store is selected by:

CACHE_STORE=local

Redis cache settings:

CACHE_REDIS_CONNECTION=default
CACHE_REDIS_PREFIX=cache:

Stores

The app ships with:

  • local: file cache under storage/cache
  • redis: Redis-backed cache using the configured Redis connection

Recommended usage:

  • use local for development and small single-node apps
  • use redis when multiple app nodes need to share cached values

Basic Usage

Using the facade:

use Myxa\Support\Facades\Cache;

Cache::put('users.count', 15);
$count = Cache::get('users.count');

Cache::remember('dashboard.stats', fn () => ['ready' => true], 300);
Cache::forget('users.count');

TTL values are in seconds.

Use a named store when needed:

Cache::put('reports.ready', true, ttl: 300, store: 'redis');

Commands

Clear the configured store:

./myxa cache:clear

Clear a named store:

./myxa cache:clear --store=local

Forget one key:

./myxa cache:forget users:123
./myxa cache:forget dashboard:stats --store=local

Use cache:forget for targeted invalidation. Use cache:clear for a full store flush.

Route Cache

Route caching is separate from application cache values.

Build the route cache:

./myxa route:cache

Clear it:

./myxa route:clear

Routes are not cached until you run route:cache.

Notes

  • Cache values should be safe to lose and rebuild.
  • Prefer explicit TTLs for data that can become stale.
  • Use Redis for shared cache state across multiple app nodes.
  • Route cache and application cache are separate systems.

Related Guides