Skip to content

Conversation

@clue
Copy link
Member

@clue clue commented Jul 3, 2019

Using arrays makes the API slightly stricter and allows consumers to
consistently rely on associative arrays for getMultiple() and
setMultiple().

I'm filing this as an RFC to discuss whether array type declaration provide more value over the current iterable type. From a practical perspective this doesn't make much of a difference because our existing ArrayCache implementation already uses array anyway. By adding this to the interface documentation, we can make the API more consistent. In particular, see the updated documentation for the getMultiple() call to see why I think this could be useful.

The iterable type was added as part of #32 by @krlv in an attempt to mimic PSR-16. While I can see some use in supporting iterable in a blocking PSR-16 implementation (such as cache warmup with a very large number of keys), I'm not sure this really applies to this async API.

Using arrays makes the API slightly stricter and allows consumers to
consistently rely on associative arrays for getMultiple() and
setMultiple().
@clue clue added the BC break label Jul 3, 2019
@clue clue added this to the v0.6.0 milestone Jul 3, 2019
@clue clue requested review from WyriHaximus and jsor July 3, 2019 17:50
Copy link
Member

@jsor jsor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense 👍

Copy link
Member

@WyriHaximus WyriHaximus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 while I normally would love iterable's it's IMHO indeed better not to do it here and enforce a static array.

@WyriHaximus WyriHaximus merged commit e13ce1a into reactphp:master Jul 4, 2019
@clue clue deleted the arrays branch July 4, 2019 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants