-
-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
/* | ||
* This file is a part of the DiscordPHP project. | ||
* | ||
* Copyright (c) 2015-present David Cole <[email protected]> | ||
* | ||
* This file is subject to the MIT license that is bundled | ||
* with this source code in the LICENSE.md file. | ||
*/ | ||
|
||
namespace Discord\Helpers; | ||
|
||
use Psr\SimpleCache\CacheInterface; | ||
|
||
/** | ||
* The cache that always be null/void | ||
*/ | ||
class VoidCache implements CacheInterface | ||
{ | ||
public function get(string $key, mixed $default = null): mixed | ||
{ | ||
return $default; | ||
} | ||
|
||
public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function delete(string $key): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function getMultiple(iterable $keys, mixed $default = null): iterable | ||
{ | ||
$result = []; | ||
|
||
foreach ($keys as $key) { | ||
$result[$key] = $default; | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function deleteMultiple(iterable $keys): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function clear(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function has(string $key): bool | ||
{ | ||
return false; | ||
} | ||
} |