Welcome Guest, Not a member yet? Register   Sign In
Readers counting does not work when caching
#1

[eluser]Unknown[/eluser]
Hello,

I have a content management system built with CoideIgniter. I used it to publish articles.

I count number of readers for each article. Everytime the page of an article is displayed, the article is loaded from mysql database to a view and there's an insert query to log IP address of reader and an article ID as a new row in database.

But when I enable caching it just shows the cached view, but new row insert does not work.

Any ideas how to insert a row before loading a cached view?

Insert code in controller:
Code:
$data = array(
   'article_id' => strip_tags($id) ,
   'ip' => $this->input->ip_address()
);

$this->db->insert('articles_impressions', $data);

And a cache code (caching for five minutes):
Code:
$this->output->cache(5);


Messages In This Thread
Readers counting does not work when caching - by El Forum - 09-30-2012, 05:24 AM
Readers counting does not work when caching - by El Forum - 09-30-2012, 01:37 PM
Readers counting does not work when caching - by El Forum - 10-02-2012, 09:45 PM
Readers counting does not work when caching - by El Forum - 10-14-2012, 04:38 AM
Readers counting does not work when caching - by El Forum - 10-16-2012, 01:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB