Welcome Guest, Not a member yet? Register   Sign In
enabling cache in database.php, a question
#1
Question 

I'm brand new to CI 4 and just installed it.  I setup database.php to match my settings and I enabled cache (cahceON=true) and set the cache folder to simply "cache" and created that folder under public.  Is this correct?  And does this setting cache the site, or just the DB?

Any tips would be most appreciated! Big Grin
Reply
#2

No, you need an absolute path. And don't store it in the public folder, you should store it in your writable folder for an example.
https://codeigniter.com/user_guide/datab...-of-values

It's only caching database objects.

Complete website: https://codeigniter.com/user_guide/general/caching.html
Caching objects: https://codeigniter.com/user_guide/libra...ching.html

The best tip I can give you are reading the User Guide from top to bottom, and then start coding so you have a grasp on where to look.
Reply
#3

(08-16-2020, 12:33 AM)jreklund Wrote: No, you need an absolute path. And don't store it in the public folder, you should store it in your writable folder for an example.
https://codeigniter.com/user_guide/datab...-of-values

It's only caching database objects.

Complete website: https://codeigniter.com/user_guide/general/caching.html
Caching objects: https://codeigniter.com/user_guide/libra...ching.html

The best tip I can give you are reading the User Guide from top to bottom, and then start coding so you have a grasp on where to look.

Great, thanks so much!! Big Grin
Reply
#4

(This post was last modified: 10-26-2020, 12:47 AM by zoldos.)

(08-16-2020, 12:33 AM)jreklund Wrote: No, you need an absolute path. And don't store it in the public folder, you should store it in your writable folder for an example.
https://codeigniter.com/user_guide/datab...-of-values

Okay, I did this in app/Config/Cache.php:

Code:
/var/www/vhosts/schismdream.com/writable/cache/

and set the cache method to "files". Then

Code:
$this->cachePage(30);

in the Home.php controller for testing purposes. It doesn't work and I get the "whoops" error page. Sad

All folders under Writeable are chmodded 777. Thanks!
Reply
#5

I'm sorry to be the bearer of bad news but database caching is not supported for CI4. This has been removed in latest develop.

Issue: https://github.com/codeigniter4/CodeIgni...ssues/3597
PR: https://github.com/codeigniter4/CodeIgniter4/pull/3608

You have to use the generic caching used by the Cache library. But expect to not have caching specific to databases.
Reply
#6

(10-26-2020, 09:17 AM)paulbalandan Wrote: I'm sorry to be the bearer of bad news but database caching is not supported for CI4. This has been removed in latest develop.

Issue: https://github.com/codeigniter4/CodeIgni...ssues/3597
PR: https://github.com/codeigniter4/CodeIgniter4/pull/3608

You have to use the generic caching used by the Cache library. But expect to not have caching specific to databases.

I mainly just want "regular" caching, not DB caching, if there is a difference. Cool  Thanks!
Reply
#7

Ok. But your post is titled cache in database.php. That's why.
Reply
#8

(10-27-2020, 01:18 AM)paulbalandan Wrote: Ok. But your post is titled cache in database.php. That's why.

Ah yes. Big Grin  My bad.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB