package and depencies

This commit is contained in:
RafficMohammed
2023-01-08 02:57:24 +05:30
parent d5332eb421
commit 1d54b8bc7f
4309 changed files with 193331 additions and 172289 deletions

View File

@@ -46,7 +46,7 @@ class CacheLock extends Lock
return ($this->seconds > 0)
? $this->store->put($this->name, $this->owner, $this->seconds)
: $this->store->forever($this->name, $this->owner, $this->seconds);
: $this->store->forever($this->name, $this->owner);
}
/**

View File

@@ -11,7 +11,8 @@ use Illuminate\Support\Arr;
use InvalidArgumentException;
/**
* @mixin \Illuminate\Contracts\Cache\Repository
* @mixin \Illuminate\Cache\Repository
* @mixin \Illuminate\Contracts\Cache\LockProvider
*/
class CacheManager implements FactoryContract
{
@@ -254,7 +255,7 @@ class CacheManager implements FactoryContract
/**
* Create new DynamoDb Client instance.
*
* @return DynamoDbClient
* @return \Aws\DynamoDb\DynamoDbClient
*/
protected function newDynamodbClient(array $config)
{
@@ -264,7 +265,7 @@ class CacheManager implements FactoryContract
'endpoint' => $config['endpoint'] ?? null,
];
if (isset($config['key']) && isset($config['secret'])) {
if (isset($config['key'], $config['secret'])) {
$dynamoConfig['credentials'] = Arr::only(
$config, ['key', 'secret', 'token']
);
@@ -328,7 +329,7 @@ class CacheManager implements FactoryContract
* Get the cache connection configuration.
*
* @param string $name
* @return array
* @return array|null
*/
protected function getConfig($name)
{
@@ -368,7 +369,7 @@ class CacheManager implements FactoryContract
*/
public function forgetDriver($name = null)
{
$name = $name ?? $this->getDefaultDriver();
$name ??= $this->getDefaultDriver();
foreach ((array) $name as $cacheName) {
if (isset($this->stores[$cacheName])) {
@@ -387,7 +388,7 @@ class CacheManager implements FactoryContract
*/
public function purge($name = null)
{
$name = $name ?? $this->getDefaultDriver();
$name ??= $this->getDefaultDriver();
unset($this->stores[$name]);
}

View File

@@ -5,7 +5,9 @@ namespace Illuminate\Cache\Console;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Composer;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cache:table')]
class CacheTableCommand extends Command
{
/**
@@ -15,6 +17,17 @@ class CacheTableCommand extends Command
*/
protected $name = 'cache:table';
/**
* The name of the console command.
*
* This name is used to identify the command during lazy loading.
*
* @var string|null
*
* @deprecated
*/
protected static $defaultName = 'cache:table';
/**
* The console command description.
*
@@ -60,7 +73,7 @@ class CacheTableCommand extends Command
$this->files->put($fullPath, $this->files->get(__DIR__.'/stubs/cache.stub'));
$this->info('Migration created successfully!');
$this->components->info('Migration created successfully.');
$this->composer->dumpAutoloads();
}

View File

@@ -5,9 +5,11 @@ namespace Illuminate\Cache\Console;
use Illuminate\Cache\CacheManager;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
#[AsCommand(name: 'cache:clear')]
class ClearCommand extends Command
{
/**
@@ -17,6 +19,17 @@ class ClearCommand extends Command
*/
protected $name = 'cache:clear';
/**
* The name of the console command.
*
* This name is used to identify the command during lazy loading.
*
* @var string|null
*
* @deprecated
*/
protected static $defaultName = 'cache:clear';
/**
* The console command description.
*
@@ -69,14 +82,14 @@ class ClearCommand extends Command
$this->flushFacades();
if (! $successful) {
return $this->error('Failed to clear cache. Make sure you have the appropriate permissions.');
return $this->components->error('Failed to clear cache. Make sure you have the appropriate permissions.');
}
$this->laravel['events']->dispatch(
'cache:cleared', [$this->argument('store'), $this->tags()]
);
$this->info('Application cache cleared!');
$this->components->info('Application cache cleared successfully.');
}
/**

View File

@@ -4,7 +4,9 @@ namespace Illuminate\Cache\Console;
use Illuminate\Cache\CacheManager;
use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand(name: 'cache:forget')]
class ForgetCommand extends Command
{
/**
@@ -14,6 +16,17 @@ class ForgetCommand extends Command
*/
protected $signature = 'cache:forget {key : The key to remove} {store? : The store to remove the key from}';
/**
* The name of the console command.
*
* This name is used to identify the command during lazy loading.
*
* @var string|null
*
* @deprecated
*/
protected static $defaultName = 'cache:forget';
/**
* The console command description.
*
@@ -52,6 +65,6 @@ class ForgetCommand extends Command
$this->argument('key')
);
$this->info('The ['.$this->argument('key').'] key has been removed from the cache.');
$this->components->info('The ['.$this->argument('key').'] key has been removed from the cache.');
}
}

View File

@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCacheTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
@@ -36,4 +36,4 @@ class CreateCacheTable extends Migration
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
}
};

View File

@@ -56,8 +56,6 @@ class DatabaseLock extends Lock
*/
public function acquire()
{
$acquired = false;
try {
$this->connection->table($this->table)->insert([
'key' => $this->name,

View File

@@ -371,7 +371,7 @@ class DatabaseStore implements LockProvider, Store
{
$result = serialize($value);
if ($this->connection instanceof PostgresConnection && Str::contains($result, "\0")) {
if ($this->connection instanceof PostgresConnection && str_contains($result, "\0")) {
$result = base64_encode($result);
}

View File

@@ -211,7 +211,7 @@ class DynamoDbStore implements LockProvider, Store
}
/**
* Store multiple items in the cache for a given number of $seconds.
* Store multiple items in the cache for a given number of seconds.
*
* @param array $values
* @param int $seconds
@@ -284,7 +284,7 @@ class DynamoDbStore implements LockProvider, Store
return true;
} catch (DynamoDbException $e) {
if (Str::contains($e->getMessage(), 'ConditionalCheckFailed')) {
if (str_contains($e->getMessage(), 'ConditionalCheckFailed')) {
return false;
}
@@ -329,7 +329,7 @@ class DynamoDbStore implements LockProvider, Store
return (int) $response['Attributes'][$this->valueAttribute]['N'];
} catch (DynamoDbException $e) {
if (Str::contains($e->getMessage(), 'ConditionalCheckFailed')) {
if (str_contains($e->getMessage(), 'ConditionalCheckFailed')) {
return false;
}
@@ -374,7 +374,7 @@ class DynamoDbStore implements LockProvider, Store
return (int) $response['Attributes'][$this->valueAttribute]['N'];
} catch (DynamoDbException $e) {
if (Str::contains($e->getMessage(), 'ConditionalCheckFailed')) {
if (str_contains($e->getMessage(), 'ConditionalCheckFailed')) {
return false;
}
@@ -529,7 +529,7 @@ class DynamoDbStore implements LockProvider, Store
/**
* Get the DynamoDb Client instance.
*
* @return DynamoDbClient
* @return \Aws\DynamoDb\DynamoDbClient
*/
public function getClient()
{

View File

@@ -89,10 +89,8 @@ class RateLimiter
*/
public function tooManyAttempts($key, $maxAttempts)
{
$key = $this->cleanRateLimiterKey($key);
if ($this->attempts($key) >= $maxAttempts) {
if ($this->cache->has($key.':timer')) {
if ($this->cache->has($this->cleanRateLimiterKey($key).':timer')) {
return true;
}

View File

@@ -7,7 +7,7 @@ class Limit
/**
* The rate limit signature key.
*
* @var mixed|string
* @var mixed
*/
public $key;
@@ -35,7 +35,7 @@ class Limit
/**
* Create a new limit instance.
*
* @param mixed|string $key
* @param mixed $key
* @param int $maxAttempts
* @param int $decayMinutes
* @return void
@@ -107,7 +107,7 @@ class Limit
/**
* Set the key of the rate limit.
*
* @param string $key
* @param mixed $key
* @return $this
*/
public function by($key)

View File

@@ -62,10 +62,10 @@ class Repository implements ArrayAccess, CacheContract
/**
* Determine if an item exists in the cache.
*
* @param string $key
* @param array|string $key
* @return bool
*/
public function has($key)
public function has($key): bool
{
return ! is_null($this->get($key));
}
@@ -84,11 +84,13 @@ class Repository implements ArrayAccess, CacheContract
/**
* Retrieve an item from the cache by key.
*
* @param string $key
* @param mixed $default
* @return mixed
* @template TCacheValue
*
* @param array|string $key
* @param TCacheValue|(\Closure(): TCacheValue) $default
* @return (TCacheValue is null ? mixed : TCacheValue)
*/
public function get($key, $default = null)
public function get($key, $default = null): mixed
{
if (is_array($key)) {
return $this->many($key);
@@ -134,7 +136,7 @@ class Repository implements ArrayAccess, CacheContract
*
* @return iterable
*/
public function getMultiple($keys, $default = null)
public function getMultiple($keys, $default = null): iterable
{
$defaults = [];
@@ -175,9 +177,11 @@ class Repository implements ArrayAccess, CacheContract
/**
* Retrieve an item from the cache and delete it.
*
* @param string $key
* @param mixed $default
* @return mixed
* @template TCacheValue
*
* @param array|string $key
* @param TCacheValue|(\Closure(): TCacheValue) $default
* @return (TCacheValue is null ? mixed : TCacheValue)
*/
public function pull($key, $default = null)
{
@@ -189,7 +193,7 @@ class Repository implements ArrayAccess, CacheContract
/**
* Store an item in the cache.
*
* @param string $key
* @param array|string $key
* @param mixed $value
* @param \DateTimeInterface|\DateInterval|int|null $ttl
* @return bool
@@ -224,7 +228,7 @@ class Repository implements ArrayAccess, CacheContract
*
* @return bool
*/
public function set($key, $value, $ttl = null)
public function set($key, $value, $ttl = null): bool
{
return $this->put($key, $value, $ttl);
}
@@ -283,7 +287,7 @@ class Repository implements ArrayAccess, CacheContract
*
* @return bool
*/
public function setMultiple($values, $ttl = null)
public function setMultiple($values, $ttl = null): bool
{
return $this->putMany(is_array($values) ? $values : iterator_to_array($values), $ttl);
}
@@ -372,10 +376,12 @@ class Repository implements ArrayAccess, CacheContract
/**
* Get an item from the cache, or execute the given Closure and store the result.
*
* @template TCacheValue
*
* @param string $key
* @param \Closure|\DateTimeInterface|\DateInterval|int|null $ttl
* @param \Closure $callback
* @return mixed
* @param \Closure(): TCacheValue $callback
* @return TCacheValue
*/
public function remember($key, $ttl, Closure $callback)
{
@@ -396,9 +402,11 @@ class Repository implements ArrayAccess, CacheContract
/**
* Get an item from the cache, or execute the given Closure and store the result forever.
*
* @template TCacheValue
*
* @param string $key
* @param \Closure $callback
* @return mixed
* @param \Closure(): TCacheValue $callback
* @return TCacheValue
*/
public function sear($key, Closure $callback)
{
@@ -408,9 +416,11 @@ class Repository implements ArrayAccess, CacheContract
/**
* Get an item from the cache, or execute the given Closure and store the result forever.
*
* @template TCacheValue
*
* @param string $key
* @param \Closure $callback
* @return mixed
* @param \Closure(): TCacheValue $callback
* @return TCacheValue
*/
public function rememberForever($key, Closure $callback)
{
@@ -448,7 +458,7 @@ class Repository implements ArrayAccess, CacheContract
*
* @return bool
*/
public function delete($key)
public function delete($key): bool
{
return $this->forget($key);
}
@@ -458,7 +468,7 @@ class Repository implements ArrayAccess, CacheContract
*
* @return bool
*/
public function deleteMultiple($keys)
public function deleteMultiple($keys): bool
{
$result = true;
@@ -476,7 +486,7 @@ class Repository implements ArrayAccess, CacheContract
*
* @return bool
*/
public function clear()
public function clear(): bool
{
return $this->store->flush();
}
@@ -583,9 +593,7 @@ class Repository implements ArrayAccess, CacheContract
*/
protected function event($event)
{
if (isset($this->events)) {
$this->events->dispatch($event);
}
$this->events?->dispatch($event);
}
/**
@@ -615,8 +623,7 @@ class Repository implements ArrayAccess, CacheContract
* @param string $key
* @return bool
*/
#[\ReturnTypeWillChange]
public function offsetExists($key)
public function offsetExists($key): bool
{
return $this->has($key);
}
@@ -627,8 +634,7 @@ class Repository implements ArrayAccess, CacheContract
* @param string $key
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($key)
public function offsetGet($key): mixed
{
return $this->get($key);
}
@@ -640,8 +646,7 @@ class Repository implements ArrayAccess, CacheContract
* @param mixed $value
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetSet($key, $value)
public function offsetSet($key, $value): void
{
$this->put($key, $value, $this->default);
}
@@ -652,8 +657,7 @@ class Repository implements ArrayAccess, CacheContract
* @param string $key
* @return void
*/
#[\ReturnTypeWillChange]
public function offsetUnset($key)
public function offsetUnset($key): void
{
$this->forget($key);
}

View File

@@ -14,14 +14,14 @@
}
],
"require": {
"php": "^7.3|^8.0",
"illuminate/collections": "^8.0",
"illuminate/contracts": "^8.0",
"illuminate/macroable": "^8.0",
"illuminate/support": "^8.0"
"php": "^8.0.2",
"illuminate/collections": "^9.0",
"illuminate/contracts": "^9.0",
"illuminate/macroable": "^9.0",
"illuminate/support": "^9.0"
},
"provide": {
"psr/simple-cache-implementation": "1.0"
"psr/simple-cache-implementation": "1.0|2.0|3.0"
},
"autoload": {
"psr-4": {
@@ -30,15 +30,15 @@
},
"extra": {
"branch-alias": {
"dev-master": "8.x-dev"
"dev-master": "9.x-dev"
}
},
"suggest": {
"ext-memcached": "Required to use the memcache cache driver.",
"illuminate/database": "Required to use the database cache driver (^8.0).",
"illuminate/filesystem": "Required to use the file cache driver (^8.0).",
"illuminate/redis": "Required to use the redis cache driver (^8.0).",
"symfony/cache": "Required to PSR-6 cache bridge (^5.4)."
"illuminate/database": "Required to use the database cache driver (^9.0).",
"illuminate/filesystem": "Required to use the file cache driver (^9.0).",
"illuminate/redis": "Required to use the redis cache driver (^9.0).",
"symfony/cache": "Required to use PSR-6 cache bridge (^6.0)."
},
"config": {
"sort-packages": true