performance - PHP Template editor using file storage , database or both?
i'm really confused i want to create a browser based template editor for my php template engine. so the use can update the code from the controller panel (something like the wordpress appearance->editor)
the question is what should i use a file storage and get the template list by using glob and update the file using file_put_content and get it using file_get_contents.
or save the template names and a description for the templates in the database and store the templates in a files
or store them all in a database
i'm really confused could someone give me a good answer please (but put performance in mind i used the default php template engine because of perfromance).
Thanks in advance
Answer
Solution:
If you go with flat files, you'll be able to easily leverage opcode caches like APC with on the generated templates. However, you'll also have to implement a semaphore to handle simultaneous attempts to write to the files.
Conversely with the database approach, you get mutual exclusion logic for free, but would have to write something else to create flat files in production, based on the db content, to get them APC cached.