JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr{ gilour

File "TusCache.php"

Full Path: /home/markqprx/iniasli.pro/common-20260222054824/Files/Tus/TusCache.php
File size: 1.02 KB
MIME-type: text/x-php
Charset: utf-8

<?php

namespace Common\Files\Tus;

use Carbon\Carbon;
use Carbon\CarbonInterface;

class TusCache
{
    public function __construct()
    {
        if (
            config('cache.default') === 'array' ||
            config('cache.default') === 'null'
        ) {
            config()->set('cache.default', 'file');
        }
    }

    public function get(string $uploadKey)
    {
        return cache()->get("tus:$uploadKey");
    }

    public function set(
        string $uploadKey,
        array $value,
        CarbonInterface $expiresAt,
    ): bool {
        return cache()->set("tus:$uploadKey", $value, $expiresAt);
    }

    public function merge(string $uploadKey, array $partialValue): bool
    {
        $value = $this->get($uploadKey);
        return cache()->set(
            "tus:$uploadKey",
            array_merge($value, $partialValue),
            Carbon::parse($value['expires_at']),
        );
    }

    public function delete(string $uploadKey): bool
    {
        return cache()->delete("tus:$uploadKey");
    }
}