I have an query like:
SELECT id as OfferId FROM offers
WHERE concat(partycode, connectioncode) = ?
AND CURDATE() BETWEEN offer_start_date
AND offer_end_date AND id IN ("121211, 123341,151512,5145626 ");
Now I want to cache the results of this query using memcache and so my question is
- How can I cache an query using memcache.
- I am currently using CURDATE() which cannot be used if we want to implement caching and so how can I get current date functionality without using CURDATE() function ?
Something like this should work:
You can take this a step further by sorting
$idsso that the same “set” of IDs (but in a different order) will still take advantage of an available cache for that set.This isn’t date-sensitive, but you can make it date sensitive by adding the date string to
$key