marko / cache
Cache interfaces and infrastructure for Marko Framework
0.0.1
2026-03-25 17:53 UTC
Requires
- php: ^8.5
- marko/config: 0.0.1
- marko/core: 0.0.1
Requires (Dev)
- marko/testing: 0.0.1
- pestphp/pest: ^4.0
This package is auto-updated.
Last update: 2026-03-25 21:07:19 UTC
README
Interfaces for caching --- defines how data is stored, retrieved, and expired, not how the backend works.
Installation
composer require marko/cache
Note: You typically install a driver package (like marko/cache-file) which requires this automatically.
Quick Example
use Marko\Cache\Contracts\CacheInterface; class ProductService { public function __construct( private CacheInterface $cache, ) {} public function getProduct(int $id): Product { $key = "product.$id"; if ($this->cache->has($key)) { return $this->cache->get($key); } $product = $this->repository->find($id); $this->cache->set($key, $product, ttl: 3600); return $product; } }
Documentation
Full usage, API reference, and examples: marko/cache