Welcome Guest, Not a member yet? Register   Sign In
Database or Files ?
#1

[eluser]Buso[/eluser]
The other day I started using serialize() to save arrays of data that can change (but not so often) into files (with no extension, as I only access the via read_file()/write_file()Wink, and found it very comfortable. I'm using it for stuff like the site's names and base_urls (to detect which app is being called, in a multi-application enviroment)

Are there any cons about this?

Of course I could have saved the data into a regular .php file, but I wanted to be able to modify it from another application, and I didn't want it to go parsing the .php file and messing with it. I tried using .xml first, but I hated it and started over with serialize(), and now I'm very happy with the result.

So now I started thinking 'why not save this way other data too? Like config variables like 'is_site_closed', or 'brand_name', etc?

Any thoughts?
#2

[eluser]WanWizard[/eluser]
The database caching system of CI works exactly the same, I don't see a reason why not to use this.
You could combine this with a small RAM disk to speed things up.

Note that you (might) have to deal with concurrency yourself, if the data isn't static. Also depending on your environment a query could be faster than disk I/O.




Theme © iAndrew 2016 - Forum software by © MyBB