[phpa] Re: cache rebalancing q's

  • From: "Nick Lindridge" <nick@xxxxxxxxxxxxxxxxxxxxx>
  • To: phpa@xxxxxxxxxxxxx
  • Date: Sun, 10 Feb 2002 11:42:30 -0000 (GMT)

> 
> Hmm, we were editing some php files and not seeing the changes. How do
> we make sure that the cache is always up to date?

The only restriction that I can see here is that file changes are only
detected with a one second granularity. 

One question, are your source files over nfs? Changes to files may not be
seen over nfs for some time, possibly 10 or more seconds, and so this can
cause problems. 

The other thing is that it's possible to fool the cache. It doesn't maintain
a record of file dependencies, and some classes are encoded with the methods
that it inherits from its parent. If you modify the class structure for a
class in a different file, derived classes in other files *may* not inherit
new methods until they are themselves changed. There are other factors that
determine whether the inheritance happens at run time or is cached, and this
isn't always an issue.

So with major changes to code structure it can be prudent to flush the cache
or touch all source files, or just not use phpa during heavy development,
but generally no special action si required. 

If it isn't one of the above situations then I can't see why you might not
see changes.

phpa first looks at the modification time of the source file, and then goes
to the shm cache for the entry. If the entry isn't there, or is there but
the modification time on the source is different to that of the cached entry
then the shm cache reports no entry.

Then the mmap (file) cache is consulted. Again, if there's no entry or the
modification time on the source is different to the cached file then it's
ignored.

Do you see the change take effect at all, or just once or twice and then
revert to the previous version?

If you do 'ls -il' on your source file then you'll see the inumber of the
file in the first column. Find the cache file with the same number, named as
phpa_xxx_nnn where nnn is the number from the ls command. Then check the
modification time on the cache file. If they are the same then the cache
file is up to date with the source file.

Another thing to try is creating a new source file, i.e.

mv source_file source_file_tmp
cp source_file_tmp source_file
rm source_file_tmp

and then seeing whether the change takes effect. Because the inumber on
source_file will now change, it will causes an entirely new cache entry to
be generated rather than updating an existing cache entry. But you'll get an
ever increasing number of redundant phpa_* files if you do this all the
time.

nick



------------------------------------------------------------------------
  www.php-accelerator.co.uk           Home of the free PHP Accelerator

To post, send email to phpa@xxxxxxxxxxxxx
To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe


Other related posts: