Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7955449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:42:54+00:00 2026-06-04T03:42:54+00:00

I have a blog-type app built on CI 2.1.0. When I add $this->output->cache(5); to

  • 0

I have a blog-type app built on CI 2.1.0.
When I add

$this->output->cache(5);

to my controller, CI correctly caches the page, and it loads quickly.

My issue is that if someone comments on that post, the comment will not show until the cache expires.

I wonder if anyone has pointers on how to force a cache refresh everytime there is a change to that specific page, or if a post edit is made, etc.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:42:55+00:00Added an answer on June 4, 2026 at 3:42 am

    From the CodeIgniter documentation:

    If you no longer wish to cache a file you can remove the caching tag
    and it will no longer be refreshed when it expires. Note: Removing the
    tag will not delete the cache immediately. It will have to expire
    normally. If you need to remove it earlier you will need to manually
    delete it from your cache folder.

    For programatically delete the cache file you can use

    CodeIgniter Cache Helper

    Here this function will delete the cache file

    function delete_cache($uri_string)
        {
            $CI =& get_instance();
            $path = $CI->config->item('cache_path');
            $cache_path = ($path == '') ? APPPATH.'cache/' : $path;
    
            $uri =  $CI->config->item('base_url').
                $CI->config->item('index_page').
                $uri_string;
    
            $cache_path .= md5($uri);
    
            if (file_exists($cache_path))
            {
                return unlink($cache_path);
            }
            else
            {
                return TRUE;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In this blog, http://www.bswebdev.com/2008/12/javascript-change-input-box-type-to-password/ I have found the following snippets for fixing change input
This is for a blog-type app, in which the blog post is shown and
I have a blog on my app and on this blog I usually put
In a Rails 3 blog type of app, I have a polymorphic comments model,
i have wordpress blog in my custom built website, i am displaying some posts
I have a blog (wordpress) and a facebook fan-page for my blog (with more
I have followed this blog post: url to integrate less with Umbraco. Also, while
I have read this excellent blog entry on the woes of strong naming and
I have a small custom blog type site and I keep track of my
In a Windows 8 style app I have a View (or page) which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.