You are here

public function Counter::setWriteCallback in Purge 8.3

Set the callback that gets called when writes occur.

The callback is called every time the counter changes value. The single only parameter passed to your callable is $value, you can use PHP's use statement to make any local variables available to it.

Parameters

callable $callback: Any PHP callable.

Overrides CounterInterface::setWriteCallback

File

src/Counter/Counter.php, line 102

Class

Counter
Provides a numeric counter.

Namespace

Drupal\purge\Counter

Code

public function setWriteCallback(callable $callback) {
  $this->callback = $callback;
}