laminas/laminas-cache
Laminas Cache provides flexible caching for PHP applications, with adapters for common backends, cache storage, patterns, plugins, and PSR-compatible integrations. Includes tools for configuring, managing, and testing cache behavior in Laminas apps.
Finally, native types everywhere. With v4.0, laminas-cache depends on laminas-servicemanager v4 which already introduced full native types and thus, cache now has native types as well.
Along with these changes, we also decided to remove and/or enhance some features to make the usage of this component more user-friendly.
So instead of working with metadata arrays, a new MetadataCapableInterface was introduced which provides a generic interface for storage adapters to tell both IDEs and static analysers to understand what metadata instances are returned for which storage adapter.
This allows per-storage Metadata which can differ depending on the storage being used.
laminas/laminas-cache v3laminas/laminas-cache-storage-adapter-* version (might differ)StorageInterface#incrementItem (no replacement available, should be implemented in userland code)StorageInterface#incrementItems (no replacement available, should be implemented in userland code)StorageInterface#decrementItem (no replacement available, should be implemented in userland code)StorageInterface#decrementItems (no replacement available, should be implemented in userland code)supportedMetadata capability (use MetadataCapableInterface#getMetadata instead)KeyListIterator with mode CURRENT_AS_METADATA (use the returned key instead and pass it to the MetadataCapable storage adapter (NOTE: not all adapters do implement MetadataCapableInterface)Serializer plugin
string as serializer option, you do not directly depend on the return value of PluginOptions#getSerializer (method will return string instead of instantiating a new SerializerInterface instance). The plugin itself can still handle string and an instance of SerializerInterface as in previous versionsLaminas\Cache\Exception\MissingKeyException, you can remove that code as the exception does not exist anymoreObjectCache pattern, that your code does not expect an instance of CallbackCache to be passedmetadata now implements MetadataCapableInterface and provides a dedicated object containing all the metadata values it supportspsr/cache and psr/simple-cache v2 & v3Laminas\Cache\Exception\MissingKeyExceptionAbstractAdapter and StorageInterface are not aware of the methods getMetadata anymore. These were moved to the new MetadataCapableInterfaceCapabilities do not provide supportedMetadata anymore. The supported metadata is tied to the used storage adapter and thus, was already requiring projects to explicitly know the exact implementation of the cache backend in case of using these metadatas anywayKeyListIterator and the corresponding IteratorInterface does not provide the mode CURRENT_AS_METADATA anymorePluginOptions#getSerializer does not create a serializer anymore if a string option was passed, instead, the string is returnedStorageInterface, so there is no more StorageInterface#incrementItem, StorageInterface#decrementItem, StorageInterface#decrementItems and StorageInterface#incrementItems
incrementItem, incrementItems, decrementItem, derementItems events (pre, post and exception)ObjectCache does not inherit the CallbackCache pattern anymoreHow can I help you explore Laravel packages today?