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

    {

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

            
'value' => serialize($value),

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

        ]);

    }
            return;

        }



        
$this->forever('interval-'.$keyserialize([

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

            
'lastRefreshedAt' => null,

            
'refreshInterval' => $seconds,

        ]));



        
$this->intervals[] = $key;

    }
            }



            try {

                
$this->forever('interval-'.$keyserialize(array_merge(

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

                )));



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

            } catch (
Throwable $e) {
    {

        
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) {
        try {

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

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

                
'wait' => $waitMilliseconds,

            ]);
        try {

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

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

            ]);

        } catch (
ConnectionException) {

            
$this->fallbackDispatcher->dispatch($tasks);
    {

        
$table $this->createSwooleTable();



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



        
$store = new OctaneStore($table);
        $store = new OctaneStore($table);



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



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

    }
    {

        
$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);
        $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);
        );



        
Http::fake([

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

        ]);



        
$this->assertEquals([
        );



        
Http::fake([

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

        ]);



        
$dispatcher->dispatch([