Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Generates a storable representation of a value
<?php serialize(mixed $value): string
<?php     public function put($key, $value, $seconds)

    {

        return $this->table->set($key, [

            'value' => serialize($value),

            'expiration' => Carbon::now()->getTimestamp() + $seconds,

        ]);

    }
<?php             return;

        }



        $this->forever('interval-'.$key, serialize([

            'resolver' => new SerializableClosure($resolver),

            'lastRefreshedAt' => null,

            'refreshInterval' => $seconds,

        ]));



        $this->intervals[] = $key;

    }
<?php             }



            try {

                $this->forever('interval-'.$key, serialize(array_merge(

                    $interval, ['lastRefreshedAt' => Carbon::now()->getTimestamp()],

                )));



                $this->forever($key, $interval['resolver']());

            } catch (Throwable $e) {
<?php     {

        OctaneFacade::route('POST', '/octane/resolve-tasks', function (Request $request) {

            try {

                return new Response(serialize((new SwooleTaskDispatcher)->resolve(

                    unserialize(Crypt::decryptString($request->input('tasks'))),

                    $request->input('wait')

                )), 200);

            } catch (DecryptException) {

                return new Response('', 403);

            } catch (TaskException|DdException) {
<?php         try {

            $response = Http::timeout(($waitMilliseconds / 1000) + 5)->post("http://{$this->host}:{$this->port}/octane/resolve-tasks", [

                'tasks' => Crypt::encryptString(serialize($tasks)),

                'wait' => $waitMilliseconds,

            ]);
<?php         try {

            Http::post("http://{$this->host}:{$this->port}/octane/dispatch-tasks", [

                'tasks' => Crypt::encryptString(serialize($tasks)),

            ]);

        } catch (ConnectionException) {

            $this->fallbackDispatcher->dispatch($tasks);
<?php     {

        $table = $this->createSwooleTable();



        $table->set('foo', ['value' => serialize('bar'), 'expiration' => time() + 100]);



        $store = new OctaneStore($table);
<?php         $store = new OctaneStore($table);



        $table->set('foo', ['value' => serialize('bar'), 'expiration' => time() - 100]);



        $this->assertNull($store->get('foo'));

    }
<?php     {

        $table = $this->createSwooleTable();



        $table->set('foo', ['value' => serialize('bar'), 'expiration' => time() + 100]);

        $table->set('bar', ['value' => serialize('baz'), 'expiration' => time() + 100]);



        $store = new OctaneStore($table);
<?php         $table = $this->createSwooleTable();



        $table->set('foo', ['value' => serialize('bar'), 'expiration' => time() + 100]);

        $table->set('bar', ['value' => serialize('baz'), 'expiration' => time() + 100]);



        $store = new OctaneStore($table);
<?php         );



        Http::fake([

            '127.0.0.1:8000/octane/resolve-tasks' => Http::response(serialize(['first' => 1, 'second' => 2, 'third' => null])),

        ]);



        $this->assertEquals([
<?php         );



        Http::fake([

            '127.0.0.1:8000/octane/dispatch-tasks' => Http::response(serialize(['first' => 1, 'second' => 2])),

        ]);



        $dispatcher->dispatch([