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

No default store in cache.php for "octane" #145

Closed
mrbenosborne opened this issue Apr 8, 2021 · 1 comment
Closed

No default store in cache.php for "octane" #145

mrbenosborne opened this issue Apr 8, 2021 · 1 comment

Comments

@mrbenosborne
Copy link

  • Octane Version: 0.1.1
  • Laravel Version: 8.36.2
  • PHP Version: 8.0.3
  • Server: Swoole
  • Database Driver & Version: NA

Description:

There is no default cache store setup for "octane", when trying to access the store the below exception is thrown.

InvalidArgumentException
Cache store [octane] is not defined.

Steps To Reproduce:

Create a new laravel project

composer create-project laravel/laravel octane-test

Require Octane

composer require laravel/octane

Run octane:install

php artisan octane:install

Set config to use Swoole

<?php

use Laravel\Octane\Contracts\OperationTerminated;
use Laravel\Octane\Events\RequestHandled;
use Laravel\Octane\Events\RequestReceived;
use Laravel\Octane\Events\RequestTerminated;
use Laravel\Octane\Events\TaskReceived;
use Laravel\Octane\Events\TickReceived;
use Laravel\Octane\Events\WorkerErrorOccurred;
use Laravel\Octane\Events\WorkerStarting;
use Laravel\Octane\Events\WorkerStopping;
use Laravel\Octane\Listeners\CollectGarbage;
use Laravel\Octane\Listeners\DisconnectFromDatabases;
use Laravel\Octane\Listeners\EnsureUploadedFilesAreValid;
use Laravel\Octane\Listeners\FlushTemporaryContainerInstances;
use Laravel\Octane\Listeners\ReportException;
use Laravel\Octane\Listeners\StopWorkerIfNecessary;
use Laravel\Octane\Octane;

return [

    /*
    |--------------------------------------------------------------------------
    | Octane Server
    |--------------------------------------------------------------------------
    |
    | This value determines the default "server" that will be used by Octane
    | when starting, restarting, or stopping your server via the CLI. You
    | are free to change this to the supported server of your choosing.
    |
    | Supported: "roadrunner", "swoole"
    |
    */

    'server' => env('OCTANE_SERVER', 'swoole'),

Attempt to use the store "octane" as per the README.md

<?php

use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Cache;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    Cache::store('octane')->put('framework', 'Laravel', 30);
});
@mrbenosborne
Copy link
Author

I solved it by putting the following in my cache.php file.

  'octane' => [
      'driver' => 'octane',
  ]

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

No branches or pull requests

1 participant