Download the PHP package sitegeist/stalemate without Composer
On this page you can find all versions of the php package sitegeist/stalemate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sitegeist/stalemate
More information about sitegeist/stalemate
Files in sitegeist/stalemate
Package stalemate
Short Description Cache with stale period and asynchronous updates
License GPL-3.0+
Informations about the package stalemate
Sitegeist.StaleMate
Varnish like cache for Neos.Flow with asynchronous updates that returns stale results in the meantime
This package implements cache that will return stale values for a configurable time while the cache values are updated asynchronously. Such behavior is well known from the varnish cache but not common in php.
The core concept is that the staleMateCache gets an identifier
and closure
for generating the required information
if it cannot be found in the cache. The closure is called immediately if no cached result is found. If a result is found
the cached result is returned.
In case the cached item is older than the intended lifetime the stale item is still returned immediately but the closure is scheduled for evaluating during the shutdown of the flow application and thus after the response has been sent to the user.
Authors & Sponsors
- Melanie Wüst - [email protected]
- Martin Ficzel - [email protected]
The development and the public-releases of this package is generously sponsored by our employer https://www.sitegeist.de.
Usage
The StaleMate cache is injected from flow.
The cache is then called via the resolve
method with an identifier
and aclosure
.
Please note that the closure cannot have arguments but instead may use
variables
from the context the method is called from.
Installation
Sitegeist.StaleMate is available via packagist. Just run composer require sitegeist/stalemate
to install it. We use semantic-versioning so every breaking change will increase the major-version number.
Comparison to Symfony Cache Contracts
The approach implemented here is somewhat similar to the symfony cache contracts but deviates in a specific way. Symfony Cache Contracts will roll a dice to upgrade cache entries before they expire to prevent mass invalidation and recomputation. Stalemate on the other hand will return the cached item and recompute the value after the response was sent to the user.
Contribution
We will gladly accept contributions. Please send us pull requests.