This page serves to give you an overview about the new content caching functionality of Ceres and IO. The caching of content data of the online store prevents a recalculating of pages upon each new page view and therefore improves the performance of the online store. Data which has already been loaded or genertated once remains in the cache and can be invoked much faster when it is accessed again.
Content caching is only available from Ceres and IO versions 2.12 onwards. Purchase the current versions of the plugins on the plentymarkets marketplace or update the plugins in the Plugins » Plugin overview.
If you, as a plugin developer, want to provide additional routes in your theme or plugin and want these to be written into the cache, you need to implement the following code snippet into your controller:
... use Plenty\Modules\ContentCache\Contracts\ContentCacheRepositoryContract; // ... /** @var ContentCacheRepositoryContract $cacheRepository */ $cacheRepository = pluginApp(ContentCacheRepositoryContract::class); $cacheRepository->enableCacheForResponse(); ...
By integrating this code, you ensure that the additional routes are written into the cache. You can see how the code is implemented in the LayoutController of IO, located in the IO/src/Controllers/LayoutController.php file.
It is furthermore possible to link variation IDs to the respective cache entry, so that the cache is invalidated upon any changes to the variations. By implementing the following code snippet, the loaded variation IDs are transmitted to the caching module when item data is loaded:
... use Plenty\Modules\ContentCache\Contracts\ContentCacheRepositoryContract; // ... /** @var ContentCacheRepositoryContract $contentCacheRepo */ $contentCacheRepo = pluginApp(ContentCacheRepositoryContract::class); $contentCacheRepo->linkVariationsToResponse($variationIds); // $variationIds = [1,2,3]; ...
In this case, the page is automatically invalidated whenever changes are being made to the variations with the IDs 1, 2 or 3.