yiisoft/cache-file
File-based cache storage for Yii, implementing PSR-16 simple cache. Stores cached values in files with TTL support, configurable cache directory, and efficient serialization for applications needing persistent, dependency-free caching.
FileCache class behind a Psr\SimpleCache\CacheInterface should evaluate this instead. The build cost is small but the maintenance and edge-case surface (TTL expiry, atomic writes, path sanitization, concurrency) is repetitive and easy to get subtly wrong.Adopt when:
yiisoft/cache and the Yii DI/config conventions) and want a filesystem handler that matches the ecosystem's interfaces.psr/simple-cache) and you need a concrete handler for local development, CI, single-server production, or air-gapped/on-prem environments.Look elsewhere when:
For executives (one paragraph): We evaluated a small open-source caching component from the Yii project that stores cached data on the local disk instead of in a separate caching server. It is permissively licensed and free, and it lets us add caching to a service without buying or operating any additional infrastructure — which matters for on-premises and customer-hosted deployments where we cannot assume a Redis server exists. The trade-off is scope: it only works well when we run on a single server or shared storage, it does not keep caches consistent across multiple servers, and it is maintained by a very small community, so we would treat it as a low-risk convenience rather than a strategic platform bet. Recommendation: adopt only where we are already in the Yii ecosystem or where a framework-neutral cache is required; for our Laravel services, use the built-in driver.
For engineering: This is a PSR-16 file handler for yiisoft/cache. It buys us a standards-compliant CacheInterface implementation with no external services, no connection management, and BSD-3 licensing. It does not buy us tags, locks, atomic multi-key operations, or cross-node coherence — those are out of scope by design. If we adopt it, we should (a) depend on the PSR-16 interface rather than the concrete class so the handler is swappable for Redis later, (b) pin the version and pin the cache directory outside the deploy artifact path, and (c) keep our own thin adapter so a fork or replacement is a one-file change. Expect to own the edge cases — TTL expiry and concurrent-write behaviour are ours to validate under load, not theirs.
How can I help you explore Laravel packages today?