Table of Contents
Laravel 13.10.0 shipped a new cache driver that most developers will want to know about immediately – especially anyone running applications on S3 or other cloud storage. Laravel v13.10.0 introduces a storage cache driver backed by Laravel’s filesystem abstraction, making it possible to use an S3 disk or any configured disk as a key/value cache store without additional packages.
This is a practical addition. If your application already has an S3 disk configured, you can now use it as a cache backend with zero extra dependencies. Here’s everything you need to know to use it.
Laravel storage cache store functionality helps developers cache files, sessions, and application data efficiently while improving Laravel application performance.
What Is the Storage Cache Store?
The storage cache driver is a new cache backend that sits on top of Laravel’s existing filesystem abstraction. Instead of pointing your cache at Redis, Memcached, or a database table, you point it at a filesystem disk – local, S3, or any other disk you’ve configured in config/filesystems.php.
The storage cache driver allows you to store cached values on any of your application’s configured filesystem disks. This can be useful when you want to use an existing disk, such as an S3 disk, as a key/value cache store.
The use case is clear: if you’re already paying for S3, you don’t need a separate Redis instance just to cache data. The storage driver gives you a cache backend that works with what you already have.
Laravel Storage Cache Store Explained
Step 1: Add the Storage Store to config/cache.php
<?php
// config/cache.php
'stores' => [
// Your existing stores...
'storage' => [
'driver' => 'storage',
'disk' => env('CACHE_STORAGE_DISK', 's3'),
'path' => env('CACHE_STORAGE_PATH', 'framework/cache/data'),
],
],
The disk value must match a disk name defined in config/filesystems.php. The path is the directory within that disk where cache files are stored.
The Laravel storage cache store system allows developers to manage cached application data using different drivers like file, Redis, and database.
Choosing the correct Laravel storage cache store driver can significantly improve application speed and scalability.
Step 2: Add Environment Variables
# .env
CACHE_STORAGE_DISK=s3
CACHE_STORAGE_PATH=framework/cache/data
If you want to use it as your default cache store:
# .env
CACHE_STORE=storage
CACHE_STORAGE_DISK=s3
CACHE_STORAGE_PATH=framework/cache/data
Step 3: Make Sure Your Disk Is Configured
Your S3 disk configuration in config/filesystems.php should already exist if you’re using S3. If not:
<?php
// config/filesystems.php
'disks' => [
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
Using the Storage Cache Store
Once configured, you use it exactly like any other cache store. The API is identical:
<?php
use Illuminate\Support\Facades\Cache;
// Use the storage store explicitly
$store = Cache::store('storage');
// Store a value for 60 minutes
$store->put('user:42:preferences', $preferences, 60);
// Retrieve a value
$preferences = $store->get('user:42:preferences');
// Store forever
$store->forever('app:config', $config);
// Check existence
if ($store->has('user:42:preferences')) {
// ...
}
// Remove a value
$store->forget('user:42:preferences');
// Or use the default store if you set CACHE_STORE=storage
Cache::put('api:response', $data, 300);
$data = Cache::get('api:response');
Output:
// Value stored as a file at:
// s3://your-bucket/framework/cache/data/[hashed-key]
Using It With the SQS Extended Store
The storage cache driver was shipped alongside an improvement to the SQS extended store – and the two features are designed to work together.
The SQS extended store now supports a flush_on_clear option. When enabled, running queue:clear will also call flush() on the configured overflow cache store after purging SQS, reclaiming storage immediately rather than waiting for TTL expiration. This matters for S3-backed stores where leftover objects incur ongoing cost.
<?php
// config/queue.php
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'extended_store_options' => [
'enabled' => true,
'disk' => 's3',
'flush_on_clear' => true, // new in 13.10.0
],
],
Without flush_on_clear, running php artisan queue:clear removes the SQS messages but leaves the payload files sitting in S3 until they expire. On a busy queue that can mean thousands of orphaned S3 objects accumulating cost. With flush_on_clear => true the cleanup happens immediately.
This option defaults to false to preserve existing behavior. Note that for most cache stores, flush() wipes the entire store – point the overflow store at a dedicated cache store to avoid unintended data loss. The new storage driver is a natural fit here.
In practice that means create a dedicated storage cache store for your SQS overflow – don’t point it at your main application cache:
<?php
// config/cache.php
'stores' => [
// Main application cache
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
],
// Dedicated store for SQS extended payloads
// Safe to flush without affecting other cache data
'sqs_overflow' => [
'driver' => 'storage',
'disk' => 's3',
'path' => 'sqs/overflow',
],
],
<?php
// config/queue.php
'extended_store_options' => [
'enabled' => true,
'store' => 'sqs_overflow', // dedicated store
'flush_on_clear' => true,
],
What Makes the Local Disk Useful Here
S3 is the obvious use case, but the local disk variant is worth considering too. Using the storage driver with the local disk is essentially the same as the existing file cache driver – but with one key difference: you can use any filesystem disk configuration including custom drivers.
<?php
// config/cache.php
'storage' => [
'driver' => 'storage',
'disk' => 'local',
'path' => 'framework/cache/data',
],
If you’ve built a custom filesystem driver or are using a third-party disk driver, the storage cache store works with it immediately without any additional cache driver code.
Important Limitations to Know Before Using It
The storage cache driver doesn’t support everything other cache drivers do. Cache tags are not supported when using the file, dynamodb, database, or storage cache drivers.
If your application uses cache tags, the storage driver isn’t a drop-in replacement for Redis or Memcached. Tags require a driver that supports them – Redis being the most common choice.
Other things to consider:
- Speed – S3 cache reads are slower than Redis or Memcached. Each cache hit is an S3 API call. Fine for infrequently accessed data, not ideal for per-request caching on high-traffic routes.
- Cost – S3 charges per API request. A busy application making thousands of cache reads per minute will accumulate meaningful S3 request costs. Monitor your S3 request counts after enabling this.
- Atomic operations – operations like
increment()anddecrement()may have race conditions on filesystem-backed stores under concurrent load. Don’t use the storage driver for rate limiting or counters.
When to Use It vs When to Use Redis
| Scenario | Use Storage | Use Redis |
|---|---|---|
| Already using S3, no Redis instance | ✅ Yes | Extra cost |
| SQS overflow payloads | ✅ Yes | Works too |
| Infrequently read, large payloads | ✅ Yes | Wastes memory |
| Per-request caching on hot routes | ❌ Too slow | ✅ Yes |
| Cache tags required | ❌ Not supported | ✅ Yes |
| Rate limiting / counters | ❌ Race conditions | ✅ Yes |
| Custom filesystem disk as cache | ✅ Yes | Not applicable |
Other Notable Changes in Laravel 13.10.0
The release included a few other additions worth knowing about:
Queue::assertPushedOnce() is a more readable alternative to Queue::assertPushedTimes(JobClass::class, 1):
<?php
// Before 13.10.0
Queue::assertPushedTimes(ProcessOrderJob::class, 1);
// After 13.10.0 - cleaner and more readable
Queue::assertPushedOnce(ProcessOrderJob::class);
QueueFake now normalizes enum queue names the same way the real queue driver does, allowing you to pass a UnitEnum case as a queue name to push() and size().
Upgrading to 13.10.0
composer update laravel/framework
Verify the version after updating:
php artisan --version
Output:
Laravel Framework 13.10.0
The storage cache driver is available immediately after upgrading. No migrations, no new Artisan commands, no breaking changes – just add the store configuration and environment variables.
Frequently Asked Questions
Can I use the storage cache driver as my default cache store?
Yes. Set CACHE_STORE=storage in your .env and configure the disk and path. Just be aware of the limitations – no cache tags, slower than Redis for per-request caching, and S3 request costs if using an S3 disk.
Does the storage cache driver work with the local disk?
Yes. Set disk to local and it stores cache files in your local filesystem. The result is similar to the existing file cache driver but backed by Laravel’s filesystem abstraction instead.
Is the storage cache driver atomic?
Not reliably under concurrent load. Operations like increment() and decrement() are not safe for high-concurrency scenarios on filesystem-backed stores. Use Redis for anything that requires atomic operations.
Will flush_on_clear delete all my S3 cache data?
Yes – that’s what it’s designed to do. This is why the Laravel docs specifically recommend pointing the SQS overflow store at a dedicated cache store rather than your main application cache. If you use your main cache store as the overflow store and enable flush_on_clear, running queue:clear will wipe all your cached application data.
What Laravel version do I need?
Laravel 13.10.0 or higher. The storage cache driver does not exist in Laravel 12 or earlier versions. If you’re on an older version you’ll need to upgrade to access this feature.
Summary
The storage cache store in Laravel 13.10.0 is a practical addition for applications already using S3 or other filesystem disks. The key points:
- Configure it in config/cache.php with
driver => 'storage', adiskname, and apath - Works with any configured filesystem disk – local, S3, or custom drivers
- Pairs naturally with SQS extended store – use a dedicated storage store for overflow with
flush_on_clear => true - No cache tags support – don’t use it as a Redis replacement if your app relies on tags
- Watch S3 request costs – monitor API call counts after enabling on high-traffic applications
Many Laravel developers use Redis as the preferred Laravel storage cache store solution for high-performance applications.
For more on Laravel caching fundamentals the official Laravel cache documentation covers every driver and configuration option in detail. For a complete Laravel application showing these patterns in practice, the Laravel CRUD application guide builds a full feature from migration to Blade views.
