This commit is contained in:
RafficMohammed
2023-02-17 13:25:50 +05:30
parent 2381fd7cf5
commit 67950fc78f
891 changed files with 102300 additions and 138477 deletions

View File

@@ -0,0 +1,16 @@
<?php
namespace Illuminate\Cache;
class FileLock extends CacheLock
{
/**
* Attempt to acquire the lock.
*
* @return bool
*/
public function acquire()
{
return $this->store->add($this->name, $this->owner, $this->seconds);
}
}

View File

@@ -12,7 +12,7 @@ use Illuminate\Support\InteractsWithTime;
class FileStore implements Store, LockProvider
{
use InteractsWithTime, HasCacheLock, RetrievesMultipleKeys;
use InteractsWithTime, RetrievesMultipleKeys;
/**
* The Illuminate Filesystem instance.
@@ -200,6 +200,31 @@ class FileStore implements Store, LockProvider
return $this->put($key, $value, 0);
}
/**
* Get a lock instance.
*
* @param string $name
* @param int $seconds
* @param string|null $owner
* @return \Illuminate\Contracts\Cache\Lock
*/
public function lock($name, $seconds = 0, $owner = null)
{
return new FileLock($this, $name, $seconds, $owner);
}
/**
* Restore a lock instance using the owner identifier.
*
* @param string $name
* @param string $owner
* @return \Illuminate\Contracts\Cache\Lock
*/
public function restoreLock($name, $owner)
{
return $this->lock($name, 0, $owner);
}
/**
* Remove an item from the cache.
*

View File

@@ -394,7 +394,9 @@ class Repository implements ArrayAccess, CacheContract
return $value;
}
$this->put($key, $value = $callback(), value($ttl));
$value = $callback();
$this->put($key, $value, value($ttl, $value));
return $value;
}

View File

@@ -34,6 +34,8 @@
}
},
"suggest": {
"ext-apcu": "Required to use the APC cache driver.",
"ext-filter": "Required to use the DynamoDb cache driver.",
"ext-memcached": "Required to use the memcache cache driver.",
"illuminate/database": "Required to use the database cache driver (^9.0).",
"illuminate/filesystem": "Required to use the file cache driver (^9.0).",