• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter Multi-level Cache

#1
Just completed this for my webiste, I upload it to Github, maybe someone else need it. Smile

https://github.com/terrylinooo/CodeIgnit...vel-Cache/

If you have troble about too many files in a cache folder, here is a solution for you, it is easy and simple.

It works both for HTML cache and SQL-object cache.
Personal blog: https://terryl.in
My personal project is called Dictpedia is currently using Codeigniter 3, welcome.
Reply

#2
Looks pretty nice. Thanks for sharing!
Reply

#3
Is this working with Session database type? or do we need to set session to "files" in app/config.php
Reply

#4
(06-03-2016, 10:11 PM)zenepay Wrote: Is this working with Session database type? or do we need to set session to "files" in app/config.php
Only read-type (SELECT) queries can be cached, since these are the only type of queries that produce a result. Write-type (INSERT, UPDATE, etc.) queries, since they don’t generate a result, will not be cached by the system.

https://www.codeigniter.com/userguide3/d...ching.html

Check out the official document here. This script only changes the cache path.  Smile
Personal blog: https://terryl.in
My personal project is called Dictpedia is currently using Codeigniter 3, welcome.
Reply

#5
Looks very interesting. Do you have some benchmarks results which shows how much benefit this splitting up the cache folders into multi levels give you if you have 100k cache files?
Reply

#6
interesting...
thanks for sharing...
Reply

#7
(06-03-2016, 10:36 PM)Diederik Wrote: Looks very interesting. Do you have some benchmarks results which shows how much benefit this splitting up the cache folders into multi levels give you if you have 100k cache files?

I don't have any benchmarks result. It is difficult to determine because different file system (FAT, NTFS, EXT3, EXT4, etc, ..) may has different result. Maybe It will not have any performance issue.. I am not sure about it.

Here is some interesting discussions

NTFS performance and large volumes of files and directories
How many files in a directory is too many? (Downloading data from net)

I set 2 levels sub-folders to separate cache files, the total sub-folders will be 36x36 = 1,296, each folder may store 5,000 files.
I made this just for avoiding some potential issues such as physical limit (for example: FAT has the limit 512 files in a folder), performance think.. 
Actually It is not necessary for small website, just share with Codeigniter friends because I like Codeigniter and use it to build my website, the community solves many my problems and I think I can share something, maybe someone else need it. 
Personal blog: https://terryl.in
My personal project is called Dictpedia is currently using Codeigniter 3, welcome.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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