skill-php-cache

Provide APCu and file-based caching with TTL invalidation for PHP applications.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/claudioborja/biblioteca --skill skill-php-cache
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: skill-php-cache
Source: https://github.com/claudioborja/biblioteca/tree/main/.agents/skills/skill-php-cache
Command: npx skills add https://github.com/claudioborja/biblioteca --skill skill-php-cache

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Lightweight, vendor-free caching for PHP apps helps avoid repetitive DB queries and slow page loads by providing APCu-based and file-based caches that work on shared hosting and VPS.

Core Features & Use Cases

  • APCu and FileCache drivers with TTL-based invalidation
  • Cache-aside pattern with remember(...) for atomic fetch-and-store
  • Fragment caching for views and partials
  • HTTP caching helpers (ETag, Last-Modified, Cache-Control)
  • Rate limiting, OPcache management integration
  • Automatic driver selection and a cron purge for file cache

Quick Start

Install dependencies, configure the cache driver (APCu or file cache), and start using the remember method to cache values.

Frequently Asked Questions about skill-php-cache

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cache database query results in PHP without external services like Redis?

You can cache database query results in PHP using the cache-aside pattern with a remember(...) method, which atomically fetches and stores values using APCu or file-based drivers without requiring Redis or Memcached.

Does PHP caching with APCu work on shared hosting environments?

Yes, PHP caching with APCu works on shared hosting and VPS environments. The system also includes a file-based cache driver with automatic selection and cron purge capabilities for environments where APCu is unavailable.

How do I set up TTL-based invalidation for PHP page fragment caching?

You can set up TTL-based invalidation for PHP page fragment caching by configuring the cache driver and using the built-in fragment caching helpers for views and partials, which support automatic time-based expiration.

What's the best way to add HTTP cache headers like ETag and Cache-Control in PHP?

The best way to add HTTP cache headers in PHP is using built-in HTTP caching helpers that manage ETag, Last-Modified, and Cache-Control headers, integrating with the underlying APCu or file-based cache layer.

Can I implement rate limiting in PHP using a file-based cache instead of APCu?

Yes, you can implement rate limiting in PHP using a file-based cache. The caching layer supports rate limiting alongside both APCu and file-based drivers, with automatic driver selection based on your environment.

When should I avoid using file-based caching in PHP applications?

You should avoid file-based caching when you need high-throughput in-memory access and APCu is available, since file-based caching relies on disk I/O and requires a cron purge for cleanup, making it slower for frequent read operations.