• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Caching question

[eluser]shadow player[/eluser]
Hello all

I'm fairly new to Codeigniter. I have been reading the user guide extensively but one question has remained open for me.

Consider this scenario:
An article page, completely static with only one little dynamic text displaying the number of views this article has got.

How could I cache such a page in order to serve it fast but still update the views counter?

Any answer will be greatly appreciated,

I do not think there is an easy solution Sad

Recently I have introduced DB Caching do some dynamic pages and it appears to be working fine.


Reactor has a caching driver.

Use it in a controller like this:
$this->load->driver('cache', array('adapter'=>'file'));

if( ! $article = $this->cache->get('article_1'))
    $article = $this->article_model->get_article(1);

$this->cache->save('article_1', $article);

Read more: http://www.gregaker.net/2011/feb/12/code...g_drivers/

For dinky little widgets like that, I usually call them in using AJAX. It allows you to quickly and completely cache the entire view using even default frontend caching, and the ajax quickly pings a controller method and gets the count and updates the html. That was my old way of doing it, I'm very much liking what bubbafoley is suggesting above, and think I'll try it with my memcached setup.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.