| 1 | <?php |
||
| 9 | class MemcachedSessionHandler extends LaravelCacheBasedSessionHandler |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Mcrouter config |
||
| 13 | * |
||
| 14 | * @var \Inspirum\Mcrouter\Model\Values\Mcrouter |
||
| 15 | */ |
||
| 16 | private $mcrouter; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Create a new cache driven handler instance. |
||
| 20 | * |
||
| 21 | * @param \Illuminate\Contracts\Cache\Repository $cache |
||
| 22 | * @param int $minutes |
||
| 23 | * @param \Inspirum\Mcrouter\Model\Values\Mcrouter|null $mcrouter |
||
| 24 | */ |
||
| 25 | 6 | public function __construct(CacheContract $cache, $minutes, Mcrouter $mcrouter = null) |
|
| 31 | |||
| 32 | /** |
||
| 33 | * Read session data |
||
| 34 | * |
||
| 35 | * @param string $sessionId |
||
| 36 | * |
||
| 37 | * @return string |
||
| 38 | */ |
||
| 39 | 4 | public function read($sessionId) |
|
| 43 | |||
| 44 | /** |
||
| 45 | * Write session data |
||
| 46 | * |
||
| 47 | * @param string $sessionId |
||
| 48 | * @param string $data |
||
| 49 | * |
||
| 50 | * @return bool |
||
| 51 | */ |
||
| 52 | 3 | public function write($sessionId, $data) |
|
| 56 | |||
| 57 | /** |
||
| 58 | * Destroy a session |
||
| 59 | * |
||
| 60 | * @param string $sessionId |
||
| 61 | * |
||
| 62 | * @return bool |
||
| 63 | */ |
||
| 64 | 2 | public function destroy($sessionId) |
|
| 68 | |||
| 69 | /** |
||
| 70 | * Get the cache key with Mcrouter shared prefix. |
||
| 71 | * |
||
| 72 | * @param string $key |
||
| 73 | * |
||
| 74 | * @return string |
||
| 75 | */ |
||
| 76 | 6 | private function getSharedKey(string $key): string |
|
| 80 | } |
||
| 81 |