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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.