friendsofhyperf/session-handler

This package is abandoned and no longer maintained. No replacement package was suggested.

Session handler for Hyperf

dev-main 2021-06-25 09:37 UTC

This package is auto-updated.

Last update: 2022-12-25 13:00:26 UTC


README

Latest Stable Version Total Downloads GitHub license

Installation

composer require friendsofhyperf/session-handler
  • memcache
composer require huizhang/memcache
  • memcached
composer require easyswoole/memcache

Configure

  • Singleton
// config/session.php

return [
    'handler' => FriendsOfHyperf\SessionHandler\Handler\MemcacheHandler::class,
    // or
    'handler' => FriendsOfHyperf\SessionHandler\Handler\MemcachedHandler::class,
    'options' => [
        // tcp://host:port
        'path' => 'tcp://127.0.0.1:11211',
        // or
        // [host, port]
        'path' => ['127.0.0.1', 11211],
        'gc_maxlifetime' => 1200,
        'session_name' => 'HYPERF_SESSION_ID',
        'domain' => null,
        'cookie_lifetime' => 5 * 60 * 60,
    ],
];
  • Cluster
// config/session.php

return [
    'handler' => FriendsOfHyperf\SessionHandler\Handler\MemcacheHandler::class,
    // or
    'handler' => FriendsOfHyperf\SessionHandler\Handler\MemcachedHandler::class,
    'options' => [
        'cluster' => true,
        'path' => [
            // [host, port, weight]
            ['127.0.0.1', 11211, 1],
            ['127.0.0.1', 11212, 1],
        ],
        // or
        // ['tcp://host:port#weight']
        'path' => [
            'tcp://127.0.0.1:11211#1',
            'tcp://127.0.0.1:11212#1',
        ],
        'gc_maxlifetime' => 1200,
        'session_name' => 'HYPERF_SESSION_ID',
        'domain' => null,
        'cookie_lifetime' => 5 * 60 * 60,
    ],
];

Support drivers

  • Memcache
  • Memcached