webvariants/slice-cache

SallyCMS addOn, enabling the use of annotations to cache slice outputs

dev-default / 1.x-dev 2014-02-18 02:11 UTC

This package is auto-updated.

Last update: 2020-08-08 14:07:13 UTC


README

This is a tiny, proof of concept addOn for SallyCMS. It adds caching to the slice renderer, allowing to cache the slice output for (at least for now) a fixed amount of time.

Requirements

  • SallyCMS 0.8+
  • PHP 5.3.3+

Installation

Add the following requirements to your composer.json:

:::json
{
    "require": {
        "webvariants/slice-cache": "$VERSION"
    }
}

Replace $VERSION with one of the available versions on Packagist.

Usage

There is just one single thing you have to do: Place an annotation with the name wv-ttl in your module (preferably in both the input and output module), containing the number of seconds the slice output can be cached for.

:::php
<?php
/**
 * @sly name     mymodule
 * @sly title    My super awesome module
 * @sly wv-ttl   600
 */

The example above would lead to the output being cached for 10 minutes.

Since the actual slice values are encoded and part of the cache key, changes in the backend lead to another cache key and appear therefore immediately.

Note: This addOn is not yet fully finished. It does not clean up its cache when an article or slice is removed and surely has some other oversights.

License

SliceCache is licensed under the MIT License - see the LICENSE file for details.