Jump to content

[SOLVED] cache prob


rarebit

Recommended Posts

Hi, i've got a list of 2800 elements in a db table, this is used to generate a form select. This is fine, but it can be a bit slow in realty. Therefore i'm wanting to cache it, no problem, until I think as to how to change the default selected element. I've either got to regenerate the list, or the only other thing I can think of is regex, arhh, actually 'str_replace' will probably be best...

 

Anyone any other suggestions?

Link to comment
https://forums.phpfreaks.com/topic/109787-solved-cache-prob/
Share on other sites

You could cache the data as an array after fetching from the database.  That eliminates the database access, though not the generation of the list.

 

But for what you're doing I think a str_replace() would work just fine.

 

Another option is you can cache an array of lines of html.  Then to set option #2453, you just edit line 2452 of the array (1 less because arrays usually start at 0).

Link to comment
https://forums.phpfreaks.com/topic/109787-solved-cache-prob/#findComment-563555
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.