Conversation
12f4f1b to
17f924d
Compare
| $result = []; | ||
|
|
||
| foreach ($keys as $key) { | ||
| $result[$key] = $default; | ||
| } | ||
|
|
||
| return $result; |
There was a problem hiding this comment.
| $result = []; | |
| foreach ($keys as $key) { | |
| $result[$key] = $default; | |
| } | |
| return $result; | |
| return array_fill_keys($keys, $default); |
Though not sure if it accepts iterable, so maybe this instead?
| $result = []; | |
| foreach ($keys as $key) { | |
| $result[$key] = $default; | |
| } | |
| return $result; | |
| return array_fill_keys(iterator_to_array($keys), $default); |
There was a problem hiding this comment.
I thought of this before, but i changed my mind
Now i forgot why i changed my mind, it was probably something with the object's getIterator() implementation and the use of Generator, but not sure which
There was a problem hiding this comment.
Pull request overview
Adds a new “void/null” PSR-16 cache helper to allow disabling caching while still satisfying the cache interface expected by the library.
Changes:
- Introduces
Discord\Helpers\VoidCacheimplementingPsr\SimpleCache\CacheInterface. - Implements no-op write operations (
set*,delete*,clear) and always-miss reads (getreturns default,hasreturns false).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/discord-php/DiscordPHP/sessions/c4bacf6c-7fa9-4447-801c-b9b09a5b534f Co-authored-by: valzargaming <7202504+valzargaming@users.noreply.github.com>
Agent-Logs-Url: https://github.com/discord-php/DiscordPHP/sessions/4948aa9c-c6c7-41e6-9547-49c9ce130606 Co-authored-by: valzargaming <7202504+valzargaming@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
A void/null cache class for PSR-16/SimpleCache implementation
might want to have its own repo