Spent last week polishing yiisoft/cache. Now I think it looks good. It’s still based on original refactoring idea of @klimov-paul i.e. main Cache class is a wrapper that takes any PSR-16 implementation as constructor argument and extends it with extra features.
Detailed readme is available. Compared to Yii 2:
It’s PSR-16 compatible so both you can use any PSR-16 implementation and the library itself could be used as a PSR-16 implementation.
Cache storage implementations are more polished.
It has modern PHP types.
Expression dependency was replaced with Callback dependency.
Chain dependency was split into Any and All.
There are multiple things to decide on before release though:
Then why remove it? IMO support for non-string keys is quite convenient. I also don’t remember using add() or addMultiple() in case of cache, but I used similar methods for persistent storage and IMO it could be useful also for cache.
Both changes make component less useful and upgrade from Yii 2 harder, so if there are no good reasons to remove it, IMO they should stay.
Nitpicking here but from looking at PSR-16 and the implementation only the storage backends implement PSR-16. I would consider “the library itself” to be the main Cache class - which is not PSR-16 compliant, mainly due to the keys.
Fixed that. Now implementing libraries are doing the check for reserverd characters and, if you pass string keys with these charactes in Cache, it will throw expected exception.
Fix looks good, but actually I meant something different. It should be made clear that Yiisoft\Cache\Cache itself is not compatible to PSR-16. Only the cache backends are. The sentence on the top of the README is a bit misleading IMO.