Framework: [5.0] [5.1] 4.2からのアップグレード後のキャッシュの問題

作成日 2016年01月05日  ·  3コメント  ·  ソース: laravel/framework

こんにちは !
私は1年以上前からlaravel4.2を実行しているプロジェクトを持っています。
今週、私は5.0、次に5.1を使用するためのアップグレードプロセスを開始し、最終的には5.2を目指しています。

5.0のアップグレードは正常に行われ、このキャッシュの問題を除いてすべてが完全に機能しました。
最初は「5.1にアップグレードして動作するか試してみよう」と思いましたが、うまくいきませんでした。

キャッシュを生成する職人のコマンドを使用して、この例外を取得します:

Refreshing the message cache...

  [InvalidArgumentException]
  Cache store [] is not defined.

最初はインストールの問題だと思いました。 Laravelの公式ドキュメントガイドに従って、すべてを最初から再インストールしました。 私はすべての構成などを再確認しました...しかし、私はまだこの問題を抱えています。

私を再現/助けるのに役立つ情報があります:

composer.jsonコンテンツ:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "laravel/framework": "5.1.*",
        "illuminate/html": "5.*",
        "andywer/js-localization": "dev-laravel-5",
        "laracasts/flash" : "~1.0"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database",
            "app/Models",
            "app/Http/Controllers"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php -r \"copy('.env.example', '.env');\"",
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "stable"
}

_cache.php_構成ファイル:

<?php

return array(

    /*
    |--------------------------------------------------------------------------
    | Default Cache Driver
    |--------------------------------------------------------------------------
    |
    | This option controls the default cache "driver" that will be used when
    | using the Caching library. Of course, you may use other drivers any
    | time you wish. This is the default when another is not specified.
    |
    | Supported: "file", "database", "apc", "memcached", "redis", "array"
    |
    */

    'driver' => 'file',

    /*
    |--------------------------------------------------------------------------
    | Cache Stores
    |--------------------------------------------------------------------------
    |
    | Here you may define all of the cache "stores" for your application as
    | well as their drivers. You may even define multiple stores for the
    | same cache driver to group types of items stored in your caches.
    |
    */
    'stores' => [
        'apc' => [
            'driver' => 'apc',
        ],
        'array' => [
            'driver' => 'array',
        ],
        'database' => [
            'driver' => 'database',
            'table'  => 'cache',
            'connection' => 'mysql',
        ],
        'file' => [
            'driver' => 'file',
            'path'   => storage_path('framework/cache'),
        ],
        'memcached' => [
            'driver'  => 'memcached',
            'servers' => [
                [
                    'host' => '127.0.0.1', 'port' => 11211, 'weight' => 100,
                ],
            ],
        ],
        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
        ],
    ],
    /*
    |--------------------------------------------------------------------------
    | Cache Key Prefix
    |--------------------------------------------------------------------------
    |
    | When utilizing a RAM based store such as APC or Memcached, there might
    | be other applications utilizing the same cache. So, we'll specify a
    | value to get prefixed to all our keys so we can avoid collisions.
    |
    */
    'prefix' => 'laravel',

);

この問題を実証するために、ホームページで簡単なキャッシュのユースケースを試しました。

        public function index()
    {
        Cache::put('toto', 'titi', 1);
        $value = Cache::get('toto');
        return View::make('pages.accueil');
    }

そして、これが私がブラウザで取得するコールスタックです(ファイル内で渡される場所を切り取ります):

Whoops, looks like something went wrong.

1/1
InvalidArgumentException in CacheManager.php line 93:
Cache store [] is not defined.
in CacheManager.php line 93
at CacheManager->resolve(null) in CacheManager.php line 77
at CacheManager->get(null) in CacheManager.php line 55
at CacheManager->store() in CacheManager.php line 318
at CacheManager->__call('put', array('toto', 'titi', '1')) in Facade.php line 222
at CacheManager->put('toto', 'titi', '1') in Facade.php line 222
at Facade::__callStatic('put', array('toto', 'titi', '1')) in AccueilController.php line 13
at Cache::put('toto', 'titi', '1') in AccueilController.php line 13
at AccueilController->index()

誰かがすでにこの種のバグに直面している、または何を試すべきかについて何か考えを持っていますか?
質問が必要な場合は、より具体的な詳細をお知らせします=)

最も参考になるコメント

さて、私は私が推測するかなり愚かです。 私のように誰かがこの「罠」に陥った場合は、ソリューションを投稿するだけです。

  • Laravel 4.2では、デフォルトのキャッシュドライバーの設定キーはたとえば"driver" => "file"です
  • Laravel 5.xでは、このキーの名前"default" => "file"です。

移行中に、新しいキー/構成を確認するためにキーごとに構成コンテンツを消去しましたが、この詳細を見逃しています。 そのため、5.1には"default" => "file"ではなく"driver" => "file"がありました

全てのコメント3件

フォーラムでお尋ねください。

さて、私は私が推測するかなり愚かです。 私のように誰かがこの「罠」に陥った場合は、ソリューションを投稿するだけです。

  • Laravel 4.2では、デフォルトのキャッシュドライバーの設定キーはたとえば"driver" => "file"です
  • Laravel 5.xでは、このキーの名前"default" => "file"です。

移行中に、新しいキー/構成を確認するためにキーごとに構成コンテンツを消去しましたが、この詳細を見逃しています。 そのため、5.1には"default" => "file"ではなく"driver" => "file"がありました

3年後でも、.envファイルを再確認して、正しい引数が提供されていることを確認してください

このページは役に立ちましたか?
0 / 5 - 0 評価