Hi mates,

I am looking for a way to cache a PHP page that it's different for each session user. For example if the paginating is used and if I have 10 pages each page contains 25 entries extracted from database, also these entries are editable when clicking on button on the page, how can I add these pages to cache? What's the best concept?

I know the Jstorage (www.jstorage.info) but I am not sure if it works in this case? I tried the caching in PHP but the problem it works on server side when creating html cache file which is not practical for having more than one session.

I am thinking to create a file on the client side and all all data from database to that file, and then if there is any modification to the page, I update both the external file and the database.. I heard about the pear-lite, but am confused..

Can you advise please? Many thanks.

Regards,

Member Avatar for LastMitch

I am looking for a way to cache a PHP page that it's different for each session user. For example if the paginating is used and if I have 10 pages each page contains 25 entries extracted from database, also these entries are editable when clicking on button on the page, how can I add these pages to cache? What's the best concept?

You can try to used this:

if( !isset($_SESSION['totalResults']) ) {
//Code to query your database for a row count
} else {
//use the total record count directly from the session variable
$myPagerObj->pageSomeData($_SESSION['total_records'], $perPage, $curPage)

I got that code from here which you can read more about it:

http://www.web-design-talk.co.uk/210/php-paging-with-caching/

and read this

http://stefanomanfredini.info/2010/09/single-query-cache-and-pagination-cache-until-a-future-post-and-ad-hoc-joins-an-over-override-of-appmodelfind/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.