Blink Cache

The Blink Cache allows you to cache expensive operations for the life of a single request.

Basic Usage

use Statamic\Facades\Blink;

Blink::put('key', 'value');
$value = Blink::get('key'); // value

A more powerful method is once. It will run a function once and cache the value.

$expensiveFunction = function() {
   return rand();
$blink->once('random', $expensiveFunction); // returns random number
$blink->once('random', $expensiveFunction); // returns the same number

Under the hood, it uses Spatie’s Blink package. You are able to use any of the methods mentioned there.


The Blink cache is organized into different “stores”, each of which are a separate Blink instances.

You can get your own Blink cache by using the store method which could be useful to prevent conflicts with other packages, or if you plan to use the flush methods.

Once you have the instance, you can call the Blink methods on it.


Without explicitly calling the store method, any methods will be targeting the “default” store shared across the application.

Betterify this page on Github!