Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Cache plugin for Coppermine?  (Read 7137 times)

0 Members and 1 Guest are viewing this topic.

Mike_PL

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Cache plugin for Coppermine?
« on: March 01, 2008, 07:57:12 am »

Is avaliabe "cache plugin" for Coppermine Photo Gallery? Where?

Thanks.
Logged

François Keller

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 9096
  • aka Frantz
    • Ma galerie
Re: Cache plugin for Coppermine?
« Reply #1 on: March 01, 2008, 08:25:52 am »

what do you mean with cache plugin ?
Logged
Avez vous lu la DOC ? la FAQ ? et cherché sur le forum avant de poster ?
Did you read the DOC ? the FAQ ? and search the board before posting ?
Mon Blog

Mike_PL

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Re: Cache plugin for Coppermine?
« Reply #2 on: March 01, 2008, 02:21:45 pm »

Hmm.. plugin like: http://mnm.uib.es/gallir/wp-cache-2/ (this is for Wordpress)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Cache plugin for Coppermine?
« Reply #3 on: March 01, 2008, 03:30:05 pm »

No, there's no page cache plugin for coppermine. Coppermine pages consist of much more dynamic data than a wordpress-driven page, that's why.
Why do you want a page cache? Is you site slow, or are you concerned about resources consumption? Both issues have been discussed before (in mayn different threads) - you should post a link to your gallery for a start and post what your actual problem is. A feature like a page-cache in itself doesn't help much - you need to know where your actual issue lies.
Logged

bitcloud

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 117
Re: Cache plugin for Coppermine?
« Reply #4 on: August 13, 2008, 05:03:20 am »

I would also like to work out a cache plugin/mod for coppermine.

The reason is that some pages might get a lot of traffic while changing very little while others remain untouched.
A caching mod would display a cached version of a page and regenerate that cached version by a user definable interval.

It could even automatically begin caching a particular PID when the number of visiters per minute exceed a certain value.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Cache plugin for Coppermine?
« Reply #5 on: August 13, 2008, 09:49:33 am »

Sure, go ahead and post your results once you're done for the benefit of others.
Logged

bitcloud

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 117
Re: Cache plugin for Coppermine?
« Reply #6 on: August 13, 2008, 05:04:13 pm »

OK, this is 1 possible solution... my code is perhaps a little clunky. Feel free to improve on it.

This caches for specific referrers... I've used frames in my original version to retain the integrity of the URL. If there is a better way of doing this, I'm all ears.

So if you put this in your displayimage.php file after "require('include/init.inc.php');" you should at least have an emergency incase of the dreaded "digg effect"

Code: [Select]
$sites = array('digg.com', 'slashdot.org', 'reddit.com', 'stumbleupon.com', 'engadget.com');
if(isset($_SERVER['HTTP_REFERER'])) {
$url = $_SERVER['HTTP_REFERER'];
$url = parse_url($url);
$spliturl = explode(".", $url['host']);
$lastpiece = count($spliturl);
$realurl = $spliturl[$lastpiece-2].".".$spliturl[$lastpiece-1];
if(in_array($realurl, $sites)) {
                        header('Location: http://'.$_SERVER['HTTP_HOST'].'.nyud.net:8080'.$_SERVER['REQUEST_URI']);
exit();
}
}
This will redirect ALL referrals from those domains to the cache. This may not be what you want, but will help you in a pinch.

To improve on this: Work out the intervals between page visits and if they fall under a certain level, you redirect to your cache... You'll need an "expiry" variable too because once it's reading from the cache, new intervals aren't being recorded.
(though what you can do is replace the "header" part of the above code with a frameset - to retain the URL integrity - and additionally in the upper frame you can record visits etc to avoid the expiry variable)

That way ONLY referrals from portal sites get redirected to the cache, and ONLY if the site is being accessed greater than X number of times a minute.

Add in a !USER_ID in there too and your registered users will never be pushed to a cache...
My version of the interval counter works, but I'm not 100% sure about it's quality yet so I won't post it here.
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.