summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Cache/Lock.php
blob: d6d60a365ee10dd0a8724fbb208407decdf24598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

declare(strict_types=1);

namespace Doctrine\ORM\Cache;

use function time;
use function uniqid;

class Lock
{
    public int $time;

    public function __construct(
        public string $value,
        int|null $time = null,
    ) {
        $this->time = $time ?? time();
    }

    public static function createLockRead(): Lock
    {
        return new self(uniqid((string) time(), true));
    }
}