chasecmiller / Crumbls-Cache

Caching for WP via PHPFastCache
4 stars 3 forks source link

would be a great addition if we can choose what type of cache we want... #1

Closed mxmkmarquette closed 7 years ago

mxmkmarquette commented 7 years ago

because it's files cache by default but would be really usefull if we can use memcached or redis from phpfastcache from a menu or whatever in the wp-admin, seriously this plugin is one of the best i tried for a long time.

chasecmiller commented 7 years ago

Thanks MX. It's really just something I've put together for a side project.

I can look into creating an admin page for that since PHPFastCache already supports those methods.

mxmkmarquette commented 7 years ago

seriously i tried it on my website was working really good, and really smooth, but my website don't have member and else it's just like admin, so i didn't know if it will break something to still use it... but seriously this thing rock big time and with an admin page and with something on the admin bar to flush the cache it will be just amazing.

mxmkmarquette commented 7 years ago

seriously it was faster than wp-rocket that i use for caching method, but if you add the choice to use either redis for both advanced and object cache, and or memcached or a mix of both, + the admin bar flush thingy i'll use it big time.

chasecmiller commented 7 years ago

Sounds great. I'll write something up tomorrow on my lunch.

It will run without pmp membership, not a problem. It was originally written to handle their system for member based content at different roles.

I'll add object cache in tomorrow.

I'm not a GUI person, but can make an admin interface. If you'd like to fork anything for the admin page, knock yourself out. That being said, there is an admin page, it just has zero options and only allows you to clear the front page, or all pages. I'll look at extending it to have options.

mxmkmarquette commented 7 years ago

no problemo with that, that's sound amazing cause seriously i love this little cache plugin it work and work better than a lot's that i tried :)

chasecmiller commented 7 years ago

Just uploaded an update. I haven't had time to test memcache, since I don't have a server setup with it. But, according to the caching engine, I am passing all arguments.

Lots to do, including testing. Feedback appreciated.

Options page is in admin, under options.

mxmkmarquette commented 7 years ago

perfect i'm testing it right now

chasecmiller commented 7 years ago

Check latest for partial object caching.

Thanks for your help!

mxmkmarquette commented 7 years ago
            'crumbls_page_cache_type' => 'files',
            'crumbls_object_cache_type' => 'files',

in plugin.php i think it will be conflictual? since it's gonna try to cache 2 times the sames thingy, by the way i have redis and memcached install on my server so i can help you with both of them.

mxmkmarquette commented 7 years ago
  thrown in /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php on line 232
[05-Apr-2017 00:04:38 UTC] PHP Fatal error:  Uncaught Error: Call to a member function getItem() on null in /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php:232
Stack trace:
#0 /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php(176): crumbls\plugins\fastcache\Plugin->read('/wp-cron.php')
#1 /home/madmax/public_html/neufsvies/wp-content/advanced-cache.php(17): crumbls\plugins\fastcache\Plugin->advancedCache()
#2 /home/madmax/public_html/wp-settings.php(84): include('/home/madmax/pu...')
#3 /home/madmax/public_html/wp-config.php(112): require_once('/home/madmax/pu...')
#4 /home/madmax/public_html/wp-load.php(37): require_once('/home/madmax/pu...')
#5 /home/madmax/public_html/wp-cron.php(26): require_once('/home/madmax/pu...')
#6 {main}
  thrown in /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php on line 232

when i try to put advanced cache and object-cache into the /wp-content/ directory, and also it error 500 wp-admin.

the version before that the flush cache into the admin bar didn't make the person comback to the cache page it was sending them to a blank page.

mxmkmarquette commented 7 years ago

if i only put advanced-cache it don't error 500 /wp-admin/ but it error 500 the front-end.

mxmkmarquette commented 7 years ago
`  thrown in /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php on line 243
[05-Apr-2017 00:21:54 UTC] PHP Fatal error:  Uncaught Error: Call to a member function getItem() on null in /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php:243
Stack trace:
#0 /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php(187): crumbls\plugins\fastcache\Plugin->read('/')
#1 /home/madmax/public_html/neufsvies/wp-content/advanced-cache.php(17): crumbls\plugins\fastcache\Plugin->advancedCache()
#2 /home/madmax/public_html/wp-settings.php(84): include('/home/madmax/pu...')
#3 /home/madmax/public_html/wp-config.php(112): require_once('/home/madmax/pu...')
#4 /home/madmax/public_html/wp-load.php(37): require_once('/home/madmax/pu...')
#5 /home/madmax/public_html/wp-blog-header.php(13): require_once('/home/madmax/pu...')
#6 /home/madmax/public_html/index.php(76): require('/home/madmax/pu...')
#7 {main}
  thrown in /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php on line 243`
chasecmiller commented 7 years ago

The reason for two options is that one is caching pages and one is an object cache. Object cache would be a great way to use memcache. I can move both to the same type and it would work fine.

I'm not able to generate the 500 error. Have any sort of log on why?

chasecmiller commented 7 years ago

Give me about 10 minutes. Trying to clean it all up and switch it to one cache instance real fast.

mxmkmarquette commented 7 years ago

yeah i know object-cache actually is the best way to use memcached depending as for redis, like wp-ffpc use advanced cache for the memcached configuration, but most of plugin to have a backend use object-cache.

i can provide you login and pass to my wordpress and my ftp if you want too maybe it's gonna be easier for you to test the thing you want too cause i have redis, predis, memcached install, and at this hour i only have 60 person on my website so we can mostly do everything we want lol.

chasecmiller commented 7 years ago

Could I look at it over the weekend or tomorrow evening? We are about to head to dinner.

Thanks for your help. Threw a new version up, it's synch'ing now. Object cache and page cache are using the same protocol and working for me.

chase@crumbls.com

mxmkmarquette commented 7 years ago

yes no problem take you time for looking at it my friend :)

tomorow or this week-end i don't want to rush you cause good things take time :)

i'm gonna email you the information of my wordpress and also the ftp :) have good appetite as we say here.

chasecmiller commented 7 years ago

Thanks!

I think the current version will interfere with logins, but will check soon. Looks like it is otherwise working pretty well.

mxmkmarquette commented 7 years ago

files work memcache work memcached don't work

chasecmiller commented 7 years ago

Guessing needs credentials for your memcached?

I'll look into it. Cleaned up a few of the files. Going to do one more push here pretty soon.

mxmkmarquette commented 7 years ago

it's telling me that either my memcached don't exist or are misconfigured.

and what's strang is that if i put... memcached.3.0.1.zip as object cached and disabling crumbls the object cache are caching and don't throw error witch habitually indicate that you either don't have memcached installed or something like that...

chasecmiller commented 7 years ago

Thanks. I'll install memcached on the server tomorrow morning to play with it some more. Should be able to troubleshoot it quickly.

mxmkmarquette commented 7 years ago

perfecto and great work by the way it exactly what i had in mind as a cache plugin it's just amazing seriously you kick ass my man.

chasecmiller commented 7 years ago

Thanks for the help! It was a little stagnant for a while, except in a private project.

mxmkmarquette commented 7 years ago

but i have a question in mind, i saw some little project on github called multi-object caching, like using redis for caching most of the group, memcached for site transient and a non persistant controller for the rest. could it be something intelligent to make crumbls something like that instead of use either memcached memcache redis or whatever as only one caching option???

chasecmiller commented 7 years ago

It could. The hard thing to do is how to present it all via a GUI. I'm not a gui guy, but can look at what they did.

mxmkmarquette commented 7 years ago

i understand it will be a challenge, but what would you think something really really simple.

like, same gui for the upper part of the plugin, to clear the cache will all the giberish that it's an alpha release and else, with the option of clearing the cache...

and like the bottom part where we chose what type of caching controller we want to use, like memcached, memcache, redis etc

then an option called like advanced option where people set the ip port etc for the caching controller

and a ULTRA advanced mode where people could choose a second and a third caching option, with a drop down menu where they choose redis, memcached, memcache etc, the ip port etc, but also they have to set the group they want to cache with what caching controller....

i don'T know if it's clear or if you can visualise that but you already made most of it :) but it's just an idea or like normal configuration, advanced configuration, expert configuration where you put a giberish like we are not responsible if you break your site bla bla bla be aware of what you are doing...

chasecmiller commented 7 years ago

I have a couple of ideas, but wanted to use the built in settings api. Might have to add some extra controls in there with some javascript. That's 100% feasible.

I just pushed another update that had a rough idea for the gui, but will probably change it.

mxmkmarquette commented 7 years ago

i love it seriously it's simple and it's working nice a gui maybe i'm minimalist but i love when it's not complicated, like seriously it a good idea of design.

chasecmiller commented 7 years ago

Thanks. I'll setup implementation for it tomorrow. Shouldn't be more than 30 minutes w/o testing. Trying to think of anything else we might want to cache that could be segmented.

mxmkmarquette commented 7 years ago

i have ask fastcomet to install memcached so i'll test it more intensively but if you want too i can test in the meantime redis and predis.

chasecmiller commented 7 years ago

Sounds great. I'll work on the GUI side of things this evening. I created CSS/JS to create more of an interface, but haven't built it out yet ( or pushed )

mxmkmarquette commented 7 years ago

no problemo :) sounds real nice

mxmkmarquette commented 7 years ago

i can confirm that memcached is working and real nice and smooth

chasecmiller commented 7 years ago

Great, thank you!

I'm working on a layout for customizable settings. If it looks good once I push it, I can work on implementation.

mxmkmarquette commented 7 years ago

is that normal by the way that when i put object-cache into the directory /wp-content/ it don't work...

chasecmiller commented 7 years ago

With memcached? It's kind of finicky. I haven't had a ton of time to check it out. I'll look at it more once I wrap up this push.

mxmkmarquette commented 7 years ago

if you want check it out on my hosting maybe it will give you more of an idea.

mxmkmarquette commented 7 years ago

and it's happening whatever method i choose the minute i put object-cache into /wp-content/ it's starting... like if i refresh or change page it take like forever to load and i finish by having error 503...

mxmkmarquette commented 7 years ago

and i retest more carefull memcached.

[07-Apr-2017 03:35:13 UTC] PHP Fatal error:  Uncaught phpFastCache\Exceptions\phpFastCacheDriverCheckException: Memcached is not installed or is misconfigured, cannot continue. in /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/assets/php/phpfastcache/src/phpFastCache/Drivers/Memcached/Driver.php:45
Stack trace:
#0 /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/assets/php/phpfastcache/src/phpFastCache/CacheManager.php(107): phpFastCache\Drivers\Memcached\Driver->__construct(Array)
#1 /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php(97): phpFastCache\CacheManager::getInstance('Memcached')
#2 /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php(32): crumbls\plugins\fastcache\Plugin->init()
#3 /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/plugin.php(566): crumbls\plugins\fastcache\Plugin->__construct()
#4 /home/madmax/public_html/neufsvies/wp-content/advanced-cache.php(15): require_once('/home/madmax/pu...')
#5 /home/madmax/public_html/wp- in /home/madmax/public_html/neufsvies/wp-content/plugins/crumbls_cache/assets/php/phpfastcache/src/phpFastCache/CacheManager.php on line 115

and memcached is install and working

like fastcomet have install it and it's working

1491454379

memcached -u madmax -d -m 64 -p 11212

1491454382

ps -axuf | grep memcached

chasecmiller commented 7 years ago

All the method checks for is the class memcached, which is true if the php extension memcached.so is is activated.

Can you do a php -i and see if it shows memcached?

chasecmiller commented 7 years ago

I didn't finish up the GUI, but am pretty close. I used jQuery UI tabs to show Page Cache Settings, Object Cache Settings and Transient Cache Settings. They allow you to inherit the prior pages or set your own. Just trying to make it look nice before the push.

mxmkmarquette commented 7 years ago

it's okay my friend take your time it's not like we are in rush i prefer that you like it and love how it look because it's important for someone to be proud of there work like in bonus of being awesome it will look good!!!

ok it's maybe a dumb question but i check with phpinfo if memcached is load http://madmax.quebec/info.php /opt/cpanel/ea-php70/root/etc/php.d/memcached.ini

like do i need to see it somewhere else if yes gonna ask fastcomet to enable it :) so that way it's gonna finaly work as it should...

mxmkmarquette commented 7 years ago

and i maybe look like someone that don't know is shit but sincerly on the server side i'm not that good, like i manage to build my wordpress with a nice theme that i customized, i learn function and some php code, a lot's of CSS lol since i'm a graphic designer so i want to help and to help you good so just tell me if i can do anything to help you except giving you 1 billions of trillions dollar that i cannot lol :P

chasecmiller commented 7 years ago

So, it should show a memcached.so file in phpinfo. It sounds like the extension isn't loaded. The extension adds in the class memcached, which you can detect.

If you added extension=memcached.so to your ini file, make sure you restart apache and it should be good to go and will show in here. I do see memcache installed.

mxmkmarquette commented 7 years ago

Not a worry, Maxime. You are unable to see the Memcached service listening on said port, due to the fact that such is an active process part of the Memcache service, which is running on the server, thus you are unable to view it via a phpinfo instance at this point in time.

That said, we can fully guarantee that it is fully running on the server and is active.

so what should i do cause it seem that memcached is install but cannot show it into phpinfo lol damn i hate so much this compagny sometime as i love it...

mxmkmarquette commented 7 years ago

so let's focus on next, redis and predis that i can test i have multiple time test it with other caching thingy

chasecmiller commented 7 years ago

Memcached may be running on the server, but the SO doesn't look like it's installed.

You can check it in PHP by something as simple as:

echo class_exists('Memcached') ? 'Memcached is installed' : 'Memcached is not installed';

I'll have some time to work on this over the weekend.

mxmkmarquette commented 7 years ago

i have a fully functionnal memcached. :) and the option is working

mxmkmarquette commented 7 years ago

and for the object cache maybe take a look at this...

https://github.com/moorscode/wp-multi-object-cache

it will tell you what we can cache as group like site-transient and else

and also it's a multi object thingy that seem to work as we intend.