ひらい ぶらり Hi-Library

ぷろぐらみんぐについて。ときどきどうでもいいことについて。

Laravel4 でSessionをMemcachedに保存したい

備忘録

  • phpのモジュールでmemcached入れておく必要があるよ
  • memcacheじゃないよ

app/config/session.php

<?php
    /*
    |--------------------------------------------------------------------------
    | Default Session Driver
    |--------------------------------------------------------------------------
    |
    | This option controls the default session "driver" that will be used on
    | requests. By default, we will use the lightweight native driver but
    | you may specify any of the other wonderful drivers provided here.
    |
    | Supported: "file", "cookie", "database", "apc",
    |            "memcached", "redis", "array"
    |
    */

    'driver' => 'memcached',

こうかきます。なんか動いてます。memcacheの設定はどこに書くのだ・・・(:3」∠)

app/config/cache.php

<?php
    /*
    |--------------------------------------------------------------------------
    | Memcached Servers
    |--------------------------------------------------------------------------
    |
    | Now you may specify an array of your Memcached servers that should be
    | used when utilizing the Memcached cache driver. All of the servers
    | should contain a value for "host", "port", and "weight" options.
    |
    */

    'memcached' => array(

        array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),

    ),

cache・・・だと・・・(:3」∠)!? 見た感じ、これ複数サーバー書くだけで分散されるんだろうか?細かい説明あんまりかいてないんだよなぁ・・・Max100なのかなぁ・・・