Learn more about how Cache providers can be used and why they exists
Cache providers are an adapter that communicates with a backend cache provider. The adapter can save, receive and delete data from the backend cache.
Cache providers are used through out the Phapi framework. It's for example used to store routes to speed up the routing process. It can also be used by middleware as well as endpoints to store and receive data that needs to be persistent between requests.
<?php
// Retrieve the cache provider
$cache = $this->container['cache'];
// Add something to the cache
$cache->set('test', 'value');
// Read something from the cache
echo $cache->get('test'); // Will echo "value"
// Check if something exists in the cache
$bool = $cache->has('test');
// Remove from cache
$cache->clear('test');
// Flush the cache
$cache->flush();
See the implement your own cache provider section for more information.
The list of cache providers are currently quite slim but more providers will be added later on.
Phapi does not include any Cache Providers by default.
There are currently no third party cache providers. Get in contact if you have implemented one and want it listed here.