Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A Simple Cache plugin
#26
mvlcek Wrote:
RobA Wrote:so cookie_functions.php doesn't get included when viewing a page in the front end. Sure it works in stand alone files because of the $base check.

If this is the only problem, you can include the cookie_functions.php yourself (or copy the cookie_check function).
But it really depends on how important the functionality is to you and the users of your plugin ;-)

Fair enough. I'd have to provide both the references hack and my own cookie function.

The other option i was playing with is to just hook the login and logout functions and create a new cookie just for my plugin...

-Rob A>
Reply
#27
Based on a PM about performance, I looked into adding Mod Rewrite caching to this plugin.

Attached is a first attempt at that if someone wants to try it.

I'm using it on my test site http://testbed.cartocopia.com/ and it seems successful.


This version adds a new option titled "Create symlinks in the home directory to allow Mod Rewrite caching." (wordy, I know).

If this option is selected, when a cache file is created in the data/other/simplecache/ directory the plugin also creates a symlink in the GS root directory named slug.html (for eample, the default page, having the slug "index" will generate a symlink named "index.html" pointed to the cache file.

To leverage this you need to:
1) set a custom permalink structure: %slug%.html
2) change your .htaccess rewrite rules to use this structure, and add the check option. Below is mine:
Code:
AddDefaultCharset UTF-8
RewriteEngine on

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#added the -l check for the cache symlinks
RewriteCond %{REQUEST_FILENAME} !-l
#for caching using custom permalink %slug%.html
RewriteRule ([A-Za-z0-9_-]+)[.]html index.php?id=$1 [QSA,L]

So what this does, is.. if a request comes in for a page like http://testbed.cartocopia.com/disqus-test-page.html the web server rules will additionally check to see if there is no symlink with that name, and if not will throw it off to index.php to generate the page (and the cache file). If the cache file (and the link to it) already exist it just serves up the cached file directly via the symlink.

This should be much faster as the php process does not even get invoked.

The only "drawback" is that you cant regenerate cached files based on time accessing them this way, as php is not being called and Mod Rewrite can't do a check for file date. The only way to regenerate them the normal simplecache way is by accessing them via the index.php?id=slug URL or just deleting them from the back end maintenance page.

I'm sure more complicated adresses could be created, but that would require code changes to the plugin as it is hard-coded to save the files as slug.html

Any thoughts on the usefulness/value of this? Not sure if I should update the version in extend...

-Rob A>
Reply
#28
It's not working for me. It outputs the HTML code, but for some reason, my browser isn't rendering it. I'm on Google chrome v12.

Also, if there is a way to not have ".html" at the end of each page, that would be great.
Make your GS site fly with SpeedySparrow cloud hosting!
Reply
#29
flam316 Wrote:It's not working for me. It outputs the HTML code, but for some reason, my browser isn't rendering it. I'm on Google chrome v12.

Also, if there is a way to not have ".html" at the end of each page, that would be great.
flam316 Wrote:It's not working for me. It outputs the HTML code, but for some reason, my browser isn't rendering it. I'm on Google chrome v12.

Also, if there is a way to not have ".html" at the end of each page, that would be great.

Use the version in extend if you don;t want the html. The only reason to have the html is to give the mod rewrite rules something to work with that clearly will identify the cache files and to let the server know to serve it up as an html file.

I've tried it in chrome with no issues here - I'm not sure how anything on the server would break a single browser implementation.... What site do you have it on?

-Rob A>
Reply
#30
RobA Wrote:Based on a PM about performance, I looked into adding Mod Rewrite caching to this plugin.

Attached is a first attempt at that if someone wants to try it.
....
Any thoughts on the usefulness/value of this? Not sure if I should update the version in extend...

-Rob A>

Well, that seemed to break 404 error handling Sad If someone wants to look at this I'd appreciate it as I'm not an expert in mod rewrite...

-Rob A>
Reply
#31
Thanks! Everything works well
my creative
ps. sorry for mistakes =)
Reply
#32
Im trying it on a NGINX server and looks like it doesnt works, im getting 1600 Req/Sec Apache vs 180 Req/Sec NGINX, while serving html files NGINX is 20% faster, and Wordpress+NGINX using w3 total cache it's also 20% faster than Apache.
Reply
#33
doice Wrote:Im trying it on a NGINX server and looks like it doesnt works, im getting 1600 Req/Sec Apache vs 180 Req/Sec NGINX, while serving html files NGINX is 20% faster, and Wordpress+NGINX using w3 total cache it's also 20% faster than Apache.

Sorry - I have no access to NGINX so can;t tell what the issue is.

Does it not work, or is it just slower? You should be able to look at a page that was delivered from the file cache be looking at the last line of the page source and see a comment like:
Code:
<!-- Page cached by SimpleCache on March 12 2012 22:55:54 -->

-Rob A>
Reply
#34
Solved! it was a nginx config issue.

Thanks a lot!

RobA Wrote:
doice Wrote:Im trying it on a NGINX server and looks like it doesnt works, im getting 1600 Req/Sec Apache vs 180 Req/Sec NGINX, while serving html files NGINX is 20% faster, and Wordpress+NGINX using w3 total cache it's also 20% faster than Apache.

Sorry - I have no access to NGINX so can;t tell what the issue is.

Does it not work, or is it just slower? You should be able to look at a page that was delivered from the file cache be looking at the last line of the page source and see a comment like:
Code:
<!-- Page cached by SimpleCache on March 12 2012 22:55:54 -->

-Rob A>
Reply
#35
Ed at ISI Wrote:Hi Rob;

A designer was telling me that this plugin is no longer needed in the latest versions of GS (3.1.1 as I type) as caching is now built-in. However, I can't find reference to that anywhere.

Any truthiness to this?

Great plugin, btw. I'm also digging your "client files" plugin.

--> e
RobA Wrote:I think you are referencing the simplecache plugin

As far as I know, 3.1.1 has caching of all page information except the page data itself in one large XML file, along with calls to access it, but not the same.

There is also htaccess based caching possible: http://get-simple.info/wiki/config:htacc...timization

...but this doesn't cache the rendered php, only the other files.

Maybe one of the devs can answer this (and move the most to the correct plugin thread..)

-Rob A>

I took the liberty of moving your reply to my misplaced question to the proper thread.

And thanks for that reply!

--> e
Reply
#36
Has this simplecahce plugin been abandonned? I tried it and nothing happened. No cahcing nor changes at all. Any ideas on how to make it work or otherwise speedup getsimple??
Reply
#37
I don't think rob is around anymore.
I'll take a look and see what it's supposed to do and why it's not working or it can be made compatible with 3.3.x I don't see why not, unless you have cache save errors or something have you Checked error logging?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#38
Quick test, works for me on 3.3.5

I got an error (folder not found or something) in Page management -> SimpleCache,
until I browsed a page in the frontend. After that, it seems to work fine.
Reply
#39
I'm around - just really busy IRL (new job/new city). as indicated it should work on the latest version of GS-

Thanks for the check Carlos.

-Rob A.
Reply




Users browsing this thread: 1 Guest(s)