PSR-6 is the Caching interface introduced by PHP-FIG last year.
There has been a lot of discussion about the interface itself, both positive and negative.
I propose starting to use this standard in mediawiki core, initially using a wrapper around the BagOStuff abstract class (see the first patch below).
Proposed usage of the wrapper can be seen in the second and third patches where it is used in the new WatchedItemStore.
The case I am trying to cover here is to allow WatchedItemStore to be able to use any kind of cache (even one that persists for longer than a single process).
This would thus allow more caching of WatchedItems and less DB calls.
To be able to effectively keep the cache in check and purge items as they change all items must be indexed (by user and by page).
The PSR-6 patches below do this using the wrapper and pulling in a library for taggable PSR caches.
An alternate solution (not using PSR-6) would likely require a BagOStuff interface that would be implemented by the current abstract base class.
This would then allow the creation of some sort of IndexedBagOStuff.
Of course with time BagOStuff could be phased out, other PSR-6 cache implementations could be used etc.
Also core could make use of further libraries building on top of the PSR.
Alternatively, the use of the PSR-6 decorator could be allowed only for third party components that need a cache, but don't want to have a dependency on MediaWiki.
- PSR-6 BagOStuff wrapper - https://gerrit.wikimedia.org/r/#/c/277756
- WatchedItemStore use PSR6 cache - https://gerrit.wikimedia.org/r/#/c/278592/
- WatchedItemStore use Taggable PSR6 cache - https://gerrit.wikimedia.org/r/#/c/278596/
BagOStuff interface extraction patch