nik_jain Posted April 12, 2019 Share Posted April 12, 2019 Purpose: Building a search function for a site, that's supposed to be fast, give results as a user types. Queries would be something like: "brand1 brand2 brand3" . My idea is , instead of querying the database on each ajax request. A keyed array is created once. Like: ['brand1' => id , 'brand2 => id2 ]. This array is stored in memory. The next time a query is sent, the array which is instantly available in memory, and can be simply queried $storedArray['brand1']to fetch any existing ids instantly. The array size would be about 750 Kb. 60000 rows. I don't have much experience with caching , so looking for advise whether what I am trying to do even makes any sense or necessary. I know there are solutions like memcache. But not sure if my tiny project requires them. Also does opcache help here ? Would serializing the array be too slow ? Please ask if any questions. Thanks Quote Link to comment Share on other sites More sharing options...
requinix Posted April 12, 2019 Share Posted April 12, 2019 opcache is for code, not data. Don't serialize: whatever you use to cache will serialize for you. A real memory cache like memcached or redis would be best. Can you? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.