cache icon indicating copy to clipboard operation
cache copied to clipboard

Support `iterable` type for all methods working with multiple keys

Open clue opened this issue 1 year ago • 0 comments

This changeset adds support for the iterable type for all methods working with multiple keys. This is done to bring the CacheInterface more in line with PSR-16 which also happens to support the iterable type (as originally suggested in #32).

  • The setMultiple() method now accepts iterable<string,mixed> $values instead of array<string,mixed>. For consumers, passing an array continues to work like usual, but implementations of the CacheInterface may have to be adjusted to accept the iterable type.
  • The deleteMultiple() method now accepts iterable<string> $keys instead of string[]. For consumers, passing an array continues to work like usual, but implementations of the CacheInterface may have to be adjusted to accept the iterable type.
  • The getMultiple() method now accepts iterable<string> $keys instead of string[] and returns an iterable<string,mixed> instead of array<string,mixed>. For consumers, passing an array continues to work as usual, but implementations of CacheInterface may have to be adjusted to accept the iterable type.

Builds on top of #58, #60, #61 and #32 Refs https://github.com/reactphp/promise/pull/225, #30 and others

clue avatar Jul 06 '24 19:07 clue