For the moment the $ttl argument is :
- an integer: it is interpreted as the number of seconds after which the item MUST be considered expired.
- a
DateTime: it is interpreted as the point in time after which the item MUST be considered expired.
As seen in this implementation example $ttl could be :
- an integer: it is interpreted as the number of seconds after which the item MUST be considered expired.
- a
DateInterval: it is interpreted as the interval after which the item MUST be considered expired - a
DateTimeInterface: it is interpreted as the point in time after which the item MUST be considered expired. null: a default value MAY be used. If none is set, the value should be stored permanently or for as long as the implementation allows.
PRO:
- It allows the addition of
DateTimeImmutableandDateIntervalas supported types
CONS:
- Should we use
DateTimeInterface(PHP5.5+) only or explicitly stateDateTime(PHP5.2+) ANDDateTimeImmutable(PHP5.5+) ? DateTimeIntervalmeans PHP 5.3+ only compatible PHP.
Adding others types raises the question for a minimal PHP version to be used with this PSR. Obviously using DateTime and namespace means the implicit minimal PHP version is PHP 5.3
TL;DR:
- No change means other added types MUST be documented at the library level: less interoperability
- Change means more flexibility at the interface level: more code for any library that wants to implement the Cache and higher PHP version requirement