You are not logged in.
Update: This should be ready for prime-time now.
Current Version: 0.9.8
Download:
asy_jpcache0-9-8.zip w/ fixes by net-carver.
Version History
Information
asy_jpcache is based on zem_cache, jpcache and some ideas from WP-Cache.
asy_jpcache will only cache complete pages (including your feeds). If you want to cache partial pages to retain some dynamic parts take a look at zem_cache which is perfect for that kind of thing.
Installation
?> insert the following line: $txpcfg['pre_publish_script'] = './jpcache/jpcache.php';If you are experiencing problems (or want to deactivate jpcache), comment out the line in your config.php that you added: //$txpcfg['pre_publish_script'] = './jpcache/jpcache.php';
Details about how JPCache works
Note: The files you received are a modified version of the original jpcache available at jpcache.com. Do NOT use this modified version for other stuff, please use the original jpcache version, because this here was hacked to serve textpattern.
After a user requests a page, JPCache will save the result-page in compressed format in the cache-directory. For subsequent requests, JPCache will
asy_jpcache will also automatically clean the cache when
asy_jpcache will not cache requests made via POST (like comment previews).
asy_jpcache will not cache file-downloads.
FAQ
I have Problems with my Feeds
There have been reports that some people have occasionally problems with the RSS/Atom-Feeds. I was not able to reliable reproduce them to find a fix. I have implemented a few things in 0.9 that should solve those problems. If you do however have problems with Feeds, please report so in the Forum. In the meanwhile you can easily turn of caching of the Feeds in jpcache-config.php by setting $JPCACHE_SKIP_FEEDS to 1.
My Textpatterns access logs keep getting shorter
That’s a good thing, because when cached files are served it is usually not recorded in the db. However if you wish to keep recording hits in the db set $JPCACHE_TXPLOG_DO to 1. Now when cache-reads are recorded to the db, jpcache will add “#cachehit” to the url. (Default is off, because cache-reads require no access to the db. Enabling this will lower performance a bit.)
I am using the XRT-Plugin
If you are using the XRT-Plugin (XML-RPC for Textpattern) by pixelmeadow, you are basically posting content to your blog without going through the Admin-Interface. Therefore the cache will not be cleaned right away. Due to the fact, that cache is periodically regenerated (default time 900 seconds), your changes may appear up to 900 seconds later on the actual site. You can shorten the default caching time in jpcache-config.php.
What happens with CSS-Requests
The stylesheets are not affected by jpcache, because they are served from a different file (not index.php). Since stylesheets usually do not change, my advice would be to put them in a regular (static) file and let the Webserver handle it (it’s more efficient).
Content-Type on PHP4
If you are using PHP4, asy_jpcache cannot get and cache the proper Content-Type of the generated page. The current workaround to this, is to take a look at the first 50 characters of the content and decide wether it’s a rss-feed, xml-feed, or text/html. This is fine for most Textpattern users. If for some reason you want to change those hardcoded headers or add more, take a look at $JPCACHE_DEFAULT_MIMETYPE in jpcache/jpcache-config.php and maybe the code in jpcache/file.php below the Line saying:
//Content-Sniffing to set correct Content-Type, because headers were not available
I am serving application/xhtml+xml sometimes
(This assumes you already have a plugin that handles this like phw_DTD )
If performance is really, really important, then don’t, because it complicates caching and lessens its benefits (at least the way it is implemented here). Otherwise:
If you are using PHP 5 simply open jpcache/jpcache-config.php and set $JPCACHE_XHTML_XML to 1. This will add the Accept-Header to the caching-key, meaning that for each URI one cache-file for every different Accept-Header will be written. Done.
If you are using PHP 4 in addition to the above you will also have to change the code that decides which Content-Type Header to send. There must be a line that is similar to header(“Content-Type: application/xhtml+xml; charset=utf-8”);. Add another line right there that sets the variable
$GLOBALS[‘JPCACHE_DEFAULT_MIMETYPE’] to something like “application/xhtml+xml; charset=utf-8”. That way, JPCache will know which Content-Type to associate with the request.
Original downloads: asy_jpcache0-9-8.tar.gz and asy_jpcache0-9-8.zip
Last edited by wet (2012-10-06 06:58:43)
Offline
Can’t get it to work. Although I’ve done:
chmod 777 /path_to/public_html/jpcache/cache/
I get the followind debug headers:
HTTP/1.1 200 OK
Date: Thu, 12 May 2005 02:01:04 GMT
Server: Apache
X-Cache: asy_jpcache v2 – file
X-CacheDebug-1: Cache scriptkey is set to /article/19/balibar
X-CacheDebug-2: Cache varkey is set to GET=a:0:{}COOKIE=dcca48101505dd86b703689a604fe3c4
X-CacheDebug-3: Cachekey is set to 82470b2f5369c9cba6cef5dd27ecef4b
X-CacheDebug-4: Failed to open for read of /path_to/public_html/jpcache/cache/jpc_82470b2f5369c9cba6cef5dd27ecef4b
X-CacheDebug-5: Invalid content of cache-file /path_to/public_html/jpcache/cache/jpc_82470b2f5369c9cba6cef5dd27ecef4b
X-CacheDebug-6: No (valid) cachedata for 82470b2f5369c9cba6cef5dd27ecef4b
X-CacheDebug-7: Callback happened
X-CacheDebug-8: Writing cached data to storage
X-Powered-By: The blood, sweat and tears of the fine, fine TextDrive staff
Served-By: TextDrive
Connection: close
Content-Type: text/html; charset=utf-8
and the following content:
<notextile><html><body></body></html></notextile>
Last edited by Etz Haim (2005-05-12 02:12:50)
VC3 :: weblog :: my wishlist
Offline
Is your Textpattern installed in the root directory?
According to the Debug-Output, a cache is not found, so the page should be generated and saved to disk. When you look inside the directory, can you see the file jpc_xxxxx? Do you always get the same output, even after requesting the same page several times?
edit: Hold on, I can’t get it to run on textdrive either. I’ll check it, and get back to you…
Last edited by Sencer (2005-05-12 07:34:23)
Offline
In the directories listed above, public_html is my virtual server root. I’ve looked inside the cache directory and never found any file at all.
VC3 :: weblog :: my wishlist
Offline
Ok, obvious one. To store the correct headers (text/html vs. application/rss+xml etc.) I am calling apache_reponse_headers(). This is only available when PHP is running as an apache module. Instead use headers_list();
—You have to edit jpcache/file.php on line 220:—
—I will update the plugin-download later.—
Ok, I updated the plugin. Please download version 0.6 (link above).
Last edited by Sencer (2005-05-12 12:45:40)
Offline
—I somehow ommitted the hook for creating articles.—
—I’ll let you know when the plugin is updated…—
—-
—Another Problem: Feeds are already gzipped by textpattern, compressing it twice leads to garbage. For now, if you are using this plugin it is better to set GZIP to 0 in—
Ok, Plugin updated to Version 0.7 and issues are fixed.
Last edited by Sencer (2005-05-17 15:02:57)
Offline
Ok, the plugin is now updated to version 0.7.
It should be mostly bugfree, and also regular users are welcome to try out this plugin.
Please install and report any experiences you have with it.
<hr>
Here is a current benchmark.
Setup:
Server: Celeron 1,7Ghz; 512MB RAM; Ubuntu Linux; Apache2, mysql4.0, php4.3 with eaccelerator
Client: Pentium 933 Mhz; 256MB RAM
Network: Switch Zyxel 660HW; 100MBit
Test run: ./ab.exe -c10 -k -n1000 -H ‘Accept-Encoding: gzip;’ http://local.testsite.de/
(Index-Page with a list of 10 relatively long articles)
Without Cache:
Requests per second: 7.69 1 (mean)
Time per request: 130.087 [ms] (mean, across all concurrent requests)
With Cache:
Requests per second: 178.00 1 (mean)
Time per request: 5.618 [ms] (mean, across all concurrent requests)
Last edited by Sencer (2005-05-17 15:37:28)
Offline
Offline