Hi
I have set up a auto suggest facility on a text field using php/mysql and ajax, this is working fine.
What I was wondering is whether it is possible to cache results returned. I feel that for every keystroke to connect to database each time coulkd be inefficient.
I have not worked with caching before but does anyone have any experience or suggestions?
Thanks in advance
ajax + php auto suggest field
Moderator: General Moderators
Re: ajax + php auto suggest field
I also have never worked with caching before but I would probably set a session with the results and store everything there, if the session isset then include the values in the list too.
If anyone else has any other suggestions I would also like to hear them
If anyone else has any other suggestions I would also like to hear them
Re: ajax + php auto suggest field
yes, setting it in a session or cookie would be good (session if you have some server resources to blow or cookies if you want to screw your user :p), but if someone types in a and 1,000,000 results are going to be cached however, it would be more efficient to connect to db each time.
Re: ajax + php auto suggest field
i am limiting the results to the nearest 10.
When was talking about caching I was thinking that it would not be user dependent. ie. person a carries out a search that sql is cached person b 5 minutes later performs the same search and gets the cached results rather than resubmitting the same query. There is a pear package cache lite that may help but have no experience with it, has anyone else used alternatives?
When was talking about caching I was thinking that it would not be user dependent. ie. person a carries out a search that sql is cached person b 5 minutes later performs the same search and gets the cached results rather than resubmitting the same query. There is a pear package cache lite that may help but have no experience with it, has anyone else used alternatives?