views:

73

answers:

2

How to Cache RAND() random images in PHP MYSQL

use to be cache for 5 seconds then on refresh its change images reply

+1  A: 

Put the images in a persistent storage (MySQL, memcache, xcache...) along with the time when they were put into storage.

When you read them, determine if the persistent storage is older than the cache limit (in this example, 5 seconds) and if it is, rebuild it before reading the images.

Victor Nicollet
xcache memcache .. I didnt Know about this please make example
Hassan
xcache and memcache are PHP-compatible cache systems that can let data persist between HTTP requests without having to put it into a database. If you want to keep your cache around for only 5 seconds, they might be better options than MySQL. See http://xcache.lighttpd.net/wiki/XcacheApi and http://php.net/manual/en/book.memcache.php
Victor Nicollet
A: 

How to use now memcached? please make example

Hassan