Savetheinternet

Savetheinternet does not currently provide support for this item.

12 comments found.

Hey,

just a quick question – part of my website (header) is different for each user (user panel, just like here on CodeCanyon). How will your plugin handle it? Previous cache plugins I used kept logging users out while serving cached version.

All you need to do is simply add some sort of variable, whether it be a cookie, IP address or something from within your code, to the object’s hash and you won’t run into that problem.

At the moment, AutoCache doesn’t cache certain parts of the page—only the entire page.

Here are some examples:
<?php
require 'auto-cache.php';
AutoCache::Hash($_SERVER['REQUEST_URI']);
// Different "username" cookie, different object.
AutoCache::Hash($_COOKIE['username']);
AutoCache::PullOrPush(10);
<?php
require 'auto-cache.php';
AutoCache::Hash($_SERVER['REQUEST_URI']);
// Different IP address, different object.
AutoCache::Hash($_SERVER['REMOTE_ADDR']);
AutoCache::PullOrPush(10);
<?php
// some code here to set $username depending
// on your application

require 'auto-cache.php';
AutoCache::Hash($_SERVER['REQUEST_URI']);
// Different IP address, different object.
AutoCache::Hash($username);
AutoCache::PullOrPush(10);

Would this make a real difference to a site served by sql? and how does it save the cached version? Thanks.

Say if i had a secrh form which relied on post data to return results but still had same URI eg search.php regardless could we do..

AutoCache::Hash($_POST[]);

And it return pages only of specific search query

Thanks

Would this make a real difference to a site served by sql?
Yes. Depending on how many queries you make any how intense they are, it will make a difference. Serving from cache means no SQL queries—absolutely no database load. > and how does it save the cached version? Thanks. Cached objects are individual PHP files.
Say if i had a secrh form which relied on post data to return results but still had same URI eg search.php regardless could we do.. AutoCache::Hash($_POST[]); And it return pages only of specific search query
Definitely. You could do something like…
<?php
require 'auto-cache.php';
AutoCache::Hash($_SERVER['REQUEST_URI']);
AutoCache::Hash($_POST['query']);
AutoCache::PullOrPush(120); // TTL is 2 minutes
... and the query would be added to the object’s hash. Although, if search queries are unlikely to ever be the same then it wouldn’t be very useful since the cached objects would almost never get used. When dealing with cache you should always look at maximizing your hitrate.

Hi, Looks like a useful tool. I have a few questions. Are the cache files deleted automatically after they expired or keeps them on the server? Thanks

You need to run AutoCache::AutoPurge() to remove all old cached objects automatically.

/**
* Remove old, stale objects.
*
* As this function iterates through (the filenames of) all objects,
* stale or not, it may be undersirable to use this on every request.
*
* You should probably include this in an administrative area so it
* won't be ran all the time OR let it be a scheduled task (using
* crontab, etc.)
*
* @return NULL
*/
Alternatively, putting it somewhere below AutoCache::PullOrPush() should suffice if you don’t have extremely high traffic.

Yeah, it make sense. Le’s say we talking about a very busy site the content doesn’t change very often, so i set ttl for like 10min. However the content changes for some reason after 2 min , i’d like to delete the old cache file so visitors wouldn’t wait another 8 min to see the new content. I hope you understand what i’m talking about.

for example on the update page could be something like:

require ‘auto-cache.php’; AutoCache::Delete($_SERVER[‘REQUEST_URI’]);

so after the update the first visitor would create a new cache. Does it make sense? Thanks

That makes perfect sense and I think I must have overlooked that. I should definitely add a AutoCache::Delete() (or something similar that does the same thing). I’ll do that when I get home, sorry.

For now, this should achieve almost the same result:
require 'auto-cache.php';
AutoCache::Hash($_SERVER['REQUEST_URI']);
unlink(AutoCache::Filename());
AutoCache::Delete() has been added.

hi, it looks awesome, congrats!

How about that delete function? is it in?

I would definetly be more interested in this if I could delete specific cache files, when updates on database occur.

Yeah, the ``AutoCache::Delete()`` function is in.

Hi want to use this auto cache plugin on my classified website spotmyads.com. I am using PHP script using on the website.

My goal is simple. I’m using Socialengine script, so first to call is index.php, which would call your script. But I’m afraid, it’s gonna cache user login and password, so another user logging in within the timeframe would get the the same user cache. My questions is, is it possible to use it even in my case? What about post and get commands withing the script, which are used for updating the wall, notifications, likes, comments … Would it be possible to integrate this as well?

whenever i run the script it says

Error: Unable to open file for writing: /home/XXXXXX/public_html/autocache/dfec926c1e11575719960ca972a0834a44a5eef0.php

although i chmod 755 both autocache.php and the autocache folder

please help ?!?

HI, DOES It work to make a web app offline able ? Best Regards S

Good product, caches my results in my search engine just perfect, tested on multiple PC’s same keyword delivers the same page for the time set.

Question : Deleting the content in the autocache folder will it flush the cache? Regards.

supported this also browsercaching

by
by
by
by
by
by