first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

47
common/Files/Tus/TusCache.php Executable file
View File

@@ -0,0 +1,47 @@
<?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");
}
}