The EvStat class
(PECL ev >= 0.2.0)
Introduction
EvStat monitors a file system path for attribute changes. It calls stat() on that path in regular intervals(or when the OS signals it changed) and sees if it changed compared to the last time, invoking the callback if it did.
The path does not need to exist: changing from "path exists" to "path does
not exist" is a status change like any other. The condition "path does not
exist" is signified by the
'nlink'
item being 0(returned by
EvStat::attr()
method).
The path must not end in a slash or contain special components such as
'.'
or
..
. The path should be absolute: if it is relative and the working directory
changes, then the behaviour is undefined.
Since there is no portable change notification interface available, the
portable implementation simply calls
stat()
regularly on the path to see if it changed somehow. For this case a
recommended polling interval can be specified. If one specifies a polling
interval of
0.0
(highly recommended) then a suitable, unspecified default value will be
used(which could be expected to be around 5 seconds, although this might
change dynamically).
libev
will also impose a minimum interval which is currently around
0.1
, but that’s usually overkill.
This watcher type is not meant for massive numbers of EvStat watchers, as even with OS-supported change notifications, this can be resource-intensive.
Class synopsis
$path
,
float
$interval
,
callable
$callback
[,
mixed
$data
= NULL
[,
int
$priority
= 0
]] )$path
,
float
$interval
,
callable
$callback
[,
mixed
$data
= NULL
[,
int
$priority
= 0
]] ) : voidTable of Contents
- EvStat::attr — Returns the values most recently detected by Ev
- EvStat::__construct — Constructs EvStat watcher object
- EvStat::createStopped — Create a stopped EvStat watcher object
- EvStat::prev — Returns the previous set of values returned by EvStat::attr
- EvStat::set — Configures the watcher
- EvStat::stat — Initiates the stat call
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-class.evstat.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.