Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Add ability to dynamically build cache repositories on-demand using Cache::build #53454

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

stevebauman
Copy link
Contributor

@stevebauman stevebauman commented Nov 9, 2024

Description

Similar to #53411, this PR implements a new Cache::build method that allows you to create new cache repositories that are not defined in your configuration file.

This is useful for circumstances where you may have cache configurations that are stored in your database, or another repository.

Usage

use Illuminate\Support\Facades\Cache;

$apc = Cache::build([
    'driver' => 'apc',
]);

$array = Cache::build([
    'driver' => 'array',
    'serialize' => false,
]);

$database = Cache::build([
    'driver' => 'database',
    'table' => 'cache',
    'connection' => null,
    'lock_connection' => null,
]);

$file = Cache::build([
    'driver' => 'file',
    'path' => storage_path('framework/cache/data'),
]); 

@stevebauman stevebauman changed the title [x.11] Add ability to dynamically build cache repositories on-demand using Cache::build [11.x] Add ability to dynamically build cache repositories on-demand using Cache::build Nov 9, 2024
@taylorotwell taylorotwell merged commit 7784219 into laravel:11.x Nov 11, 2024
33 checks passed
@browner12
Copy link
Contributor

I wonder if this could be incorporated into the new cache based Password Resets feature? force a separate store if none is provided to the config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants