1

I'm using Feeds to import data from Site A to Site B. Feeds runs every 15 minutes to check for new content, via cron / job_scheduler. I have caching turned on, with minimum lifetime and expiration both set to 15 minutes, with the hope that content will be rebuilt for anonymous users every 15 minutes.

The problem I'm having is that if Feeds updates a node and brings over a new image (or the same image; Feeds renames the same image every time the parent node updates) then the image on the rendered node is broken, as the original image doesn't exist anymore. e.g. example.com/files/image.jpg is deleted and replaced with image_0.jpg, while the cached page still has image.jpg in its source. Is there a good way to combat this, outside of having Feeds replace the existing file?

  • did you think of clearing cache for that node after feeds has run? – Andre Baumeier Feb 7 '13 at 20:42
  • Feeds runs every 15 minutes. I could add a custom cron job that clears the cache and make sure this runs after feeds, but doing a cache_clear_all() seems rather intense – I don't want to clear the menu cache, ctools caches, views caches, etc. What caches should I clear to ensure only the node content is being rebuilt? – Charlie Schliesser Feb 7 '13 at 21:36
2

You might attach a cache_clear_all() at the end of your import task.

So every time Feeds updates your content, your cache will be reset.

Your cache will be handled right when it's needed. It's not safe in my opinion to rely on "coincidence" between import time and cache lifetime.

  • I agree. I'm not expecting things to coincide with each other (i.e. content doesn't have to import at 3:00 and immediately be available, but within 15 minutes of the last import would be good). cache_clear_all() could be thrown into a custom cron job, but isn't clearing all caches including cache_menu, etc., kind of intense? – Charlie Schliesser Feb 7 '13 at 21:39
  • 1
    Only cache_page and cache_block tables are affected. – ermannob Feb 7 '13 at 21:48
  • I didn't realize that – thanks! I'll give this a shot. – Charlie Schliesser Feb 7 '13 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.