php-cooper

CacheEvent
in package

FinalYes

What a `Cache::listen()` listener receives -- the PHP counterpart of the Elixir original's `[:cooper, :cache, :file_changed]` and `[:cooper, :cache, :env_changed]` telemetry events.

  • FILE_CHANGED: a previously cached entry was found stale because a contributing file's modification time changed, and has just been re-parsed. $changed lists those files. Never fired for an entry's first population.
  • ENV_CHANGED: an environment variable that shaped a cached tree (a ${?NAME} guard, ${NAME} in an import path or an interpolated key) has a different value now, so the entry was dropped and the file re-parsed. $changed lists those names.

Table of Contents

Constants

ENV_CHANGED  : mixed = 'env_changed'
FILE_CHANGED  : mixed = 'file_changed'

Properties

$changed  : array<string|int, mixed>
$path  : string
$root  : string
$time  : float
$type  : string

Methods

__construct()  : mixed

Constants

ENV_CHANGED

public mixed ENV_CHANGED = 'env_changed'

FILE_CHANGED

public mixed FILE_CHANGED = 'file_changed'

Properties

$changed read-only

public array<string|int, mixed> $changed

Methods

__construct()

public __construct(string $type, string $path, string $root, array<int, string> $changed, float $time) : mixed
Parameters
$type : string

FILE_CHANGED or ENV_CHANGED

$path : string

the cached entry file's absolute path

$root : string

the root its bare imports resolve against

$changed : array<int, string>

the changed files, or the changed variable names

$time : float

when it happened, as a Unix timestamp with microseconds

On this page

Search results