amnuts / opcache-gui

A clean, effective and responsive interface for Zend OPcache
1.21k stars 197 forks source link

what is the essence? #30

Closed bhaktadas closed 4 years ago

bhaktadas commented 6 years ago

Hi!

Thank you very much for tool, which is real convenient in use. (sorry for my English...)

For my website I have noticed very useful moment that if in the browser I switch on real-time update then files in a cache are saved long time and if no visitors some time a cache isn't nullified and php the code is always compiled.

I have thought to make same effect through cron, however, as I can see, your script contains javascript that makes run on cron impossible...

What is the essence of your script which can be started from php? (I watched your code and I did attempts to realize it, but I am not the real programmer)

PS may be it will be interesting to expand possibilities of the script, having complemented it with the file which users can start on cron.

Thanks in advance! Creative achievements!

amnuts commented 6 years ago

Hi and thanks for the feedback.

The essence is really the class which goes from line 48 to line 245. The class collates the information from the OPCache and provide you with the methods to reset the files, and so on.

The initmethod simply handles the requests on the query string and makes sure the options have been set to allow certain things, but it'll give you an idea of how to call whatever methods you want. But essentially you would instantiate the class (with something like $opc = new OpCacheService();) and then call whatever methods you want on it, like $opc->resetCache();

All the HTML And JS is there to do is provide a visual interface to that data that OpCacheService throws back at you. :)

Hope that helps!

bhaktadas commented 6 years ago

Thank you very much for your answer. I will try.

bhaktadas commented 6 years ago

Hi, Amnuts!

I am very sorry, but it is impossible to me yet...

At most, what I could reach, to make on the basis of your script other file with autoupdating which does refresh without the "Enable Real-time update" button.

I couldn't make the version for the cron - I cannot understand which line and php-code (connected with javascript reload) allows my cache not to have restart...

I don't insist on the help, just I write about report and frustration...

amnuts commented 6 years ago

What exactly are you trying to do?

You want to run the script with cron, I get that, but what are you looking to do with the output from the cron script? Are you going to log it? Email it? Something else? Or is it because you don't want files being cached because of this script?

When in "real time" mode, the only file this script will keep alive in the cache is itself, as it has to call itself on a timer. No other script is kept alive longer because of this one. If you're seeing that it may be one of two things; your OPCache settings are keeping things alive a long time, or this script isn't reporting the status very well for you.

bhaktadas commented 6 years ago

Thank you for support and help!

I want to keep my files in opcache keep alive to long time.

On my hosting I have the answer of the server indecently big (12-15 s.) if site didn't use more than several minutes. It is LMS, opcache recommended and no other cache plugins.

Usual life time of a opcache - about a one minute or two minutes.

If I use your script with real time refreshing via the browser then cached opcode can be stored vaguely long (in cached files, as you wrote, I can see your opcache-gui.php and all my files in a cache without reseting). And it is pleasant to me - the website is any time ready to open very quickly. Your real time refresh helps a cache not to be nullified each several minutes.

Therefore I look for a way to excite opcache through cron in the same way as it remarkably does your script via the browser. I am not coder or sysadmin - so I don't know how he did it and how it possible with opcache (it is opcache's bug or features?). But I see that it works fine.

bhaktadas commented 6 years ago

Therefore I have thought that may be it is easy to prompt me or it is interesting to add to your script new function - keep alive cache with cron. ;)

BitPopCoin commented 5 years ago

No running this script does not keep your files cached. Just forget what you're trying to do. But if you want, the essence is one function: http://php.net/manual/en/function.opcache-get-status.php

bhaktadas commented 5 years ago

Why not? It is work very good. While checking link is open in the browser and auto-refresh is On.