Welcome Guest, Not a member yet? Register   Sign In
caching common items
#1

[eluser]AtlantixMedia[/eluser]
Hello,

this question is in regard to caching commonly used items which rarely change like dropdown menus, profile fields, etc.

In my previous procedural projects, I used to have all this data in a database, dump it into arrays and save them to a php file which would then be included where needed to build menus on the fly.

Under CI-MVC should I:

1)save them to a config file and load it where I need it (basically the same thing I was doing with the other method)
2)use CI caching
3)or some other technique?

thanks
#2

[eluser]nmweb[/eluser]
I'd use a custom cache library. Your first option is not what config files are for, especially if you use dynamic menus you'd have to generate config files and that wouldn't be a neat solution. Optino 2, using CI caching only works for either pages or queries. Pages is not an option if you have dynamic content, query caching caches only the query and nothing else. Using a custom cache library you can cache snippets of a page, this would be the preferred solution.
#3

[eluser]AtlantixMedia[/eluser]
Hello,

thanks for your reply. the menus I'm talking about are not dynamic though. For example, a list of countries to choose from in a user registration system. That never changes. Does your suggestion still apply to this situation?

thanks
#4

[eluser]Mark van der Walle[/eluser]
I would use some custom functions and cache the generated HTML. You can read the file pass it to your view and presto!




Theme © iAndrew 2016 - Forum software by © MyBB