Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Today I realized that with my list of cities / substates / states (2000 positions) I waste resources of server and for every now and then it is regenerated in some places where Couch caching is not used.

I want to use some cache and not fetch cities in <select><option> over and over again. I think, when templates are updated with new cities, super-admin can regenerate the snippet and it will be used.

Probably I would need some code to create files and also some replacement code, to change a certain class according to a value. Like, if city = mycity, then replace 'city' with 'city class="active" '. I know it can be done with php, but before I dig in maybe I should know something!
Appreciate all advice and ideas :)
File-creating part can be done manually if this is only once in a while and on demand. It simply can be generated in browser with couch tag cms:html_encode :)
Difference in speed :) Normal fetching pages and related pages: Page generated in: 2.733 sec
Queries: 7654. Serving static snippet: Page generated in: 0.103 sec Queries: 25.
So it's basically a manual caching of data. 20 users with 2.5 sec for first request and probably 15-20sec for the last is a game changer, compared to serving static data and a slight manipulation of it.
Finally, to change <option> on demand in embedded 100kb snippet this code was used and it runs so fast, I can't even track the milliseconds :D
Code: Select all
<cms:php>
echo str_replace('<cms:show myoption />',
                    '<cms:show myoption_active />',
                    '<cms:embed 'data/optgroup_option_locations.html' />');
</cms:php>
4 posts Page 1 of 1
cron