• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple Resource Loading in CI

#1
[eluser]dblackherod[/eluser]
CI is quite amazing during application developments using PHP. However one thing I have noticed over the years using this framework is its resource loading concept. A quick illustration would suffice;

1. increase the log threshold in APPPATH . config/config.php to 4.
2. refresh a page in your app.
3. observe the contents in APPPATH . logs/<System-Date>.php

What you will find my friend is a repetition of controllers, models, libraries and helpers loaded by CI; infact, the more a page is requested in CI, the more the same resources are loaded repeatedly. The CI guide also mentions that when the database library is autoloaded, same library will be called with every page load.

I am thinking there's got to be a way to cache resources loaded and simply reuse them on subsequent requests.

Any thoughts on this proposition and how to begin?.

#2
[eluser]Ed Robindon[/eluser]
Is this not due to the stateless nature of the internet and http?

Every time a page is called for everything starts over again whereas the log is a continuous record of all logged events.

CI has caching available but isn't it the same thing? Load the cached resource and execute it?

On the other hand, I may have it all wrong...

#3
[eluser]Aken[/eluser]
A PHP script is not a server resource - there's no way to "store" it for use on another HTTP request.

The best thing you can do is set up your application to only use resources when you need them. You can do this individually in different controllers/models/libraries, through base classes like MY_Controller, etc.

#4
[eluser]dblackherod[/eluser]
Alright people... I got it. So to achieve what i'm proposing, i'd have to get a Web Sockets Library working with CI, then host on a WS enabled PHP Server and then request the app/page with a WS enabled browser is it?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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