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 8476471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:11:19+00:00 2026-06-10T18:11:19+00:00

I am new to codeigniter. I want to use file-based caching.I don’t know if

  • 0

I am new to codeigniter. I want to use file-based caching.I don’t know if I understood correctly.
1. Declare the following in the parent controller —$this->load->driver('cache');
2. $this->cache->file->save('foo', 'bar', 10); is used to save the file but i don’t know what are the parameters of this function and how to implement all these so that caching can be done.
Please help

  • 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-10T18:11:20+00:00Added an answer on June 10, 2026 at 6:11 pm

    http://codeigniter.com/user_guide/libraries/caching.html#example_usage
    The manual has it – but it’s a bit hidden in the example:

    if ( ! $foo = $this->cache->get('foo'))
    {
         echo 'Saving to the cache!<br />';
         $foo = 'foobarbaz!';
    
         // Save into the cache for 5 minutes
         $this->cache->save('foo', $foo, 300);
    }
    

    ‘foo’ -> the name for the variable you’re about to cache
    $foo -> the variable to cache. It can be anything
    300 -> time in seconds (60*5) – set to 0 for no expiry

    So IF $foo is empty the cache file is recreated, else you can use $foo to load data.

    Further notes:
    http://codeigniter.com/user_guide/general/caching.html

    A more flexible alternative could be this sparks library:
    http://getsparks.org/packages/cache/show
    I use it and it fits my needs for file-based caching very well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to codeigniter. I want to know use of $CI =& get_instance();
I want to use a new file containing constants in Codeigniter so I created
I have a CodeIgniter project. I want to use Memcache, but I don't want
I am new in codeigniter, even in PHP. I want to upload a zipped
I am still new into Codeigniter framework. Today I read about Database Caching http://codeigniter.com/user_guide/database/caching.html
I'm new in codeigniter I have problem I use my OS X Lion, and
I'm still very new to codeigniter. The issue i'm having is that the file
I'm new to Code Igniter. I want to use some 3rd party classes in
I want to create secure cf using CodeIgniter. I'm new to using CodeIgniter. Is
I'm pretty new to codeigniter and I am trying to get to know databases

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.