I have some relatively complex and costly code which extracts details of images from a JAlbum album, and displays that info with relevant posts. This currently runs every time the post is displayed, and works fine.
I want to cache this data as post metadata, so that in appropriate circumstances I just use the cached data and save on a lot of processing time. I have the following code which is called as part of my processing loop, which I expected to save the values back to the relevant post:
update_post_meta($imagePostID, 'slideDate', $slideDate);
update_post_meta($imagePostID, 'imagePath', $imagePath);
update_post_meta($imagePostID, 'imageMeta', $imageMeta);
The problem is that it's not saving the values. I suspect that this is because it's not in the context of a "save" event. Is there something else I need to do to save these changes on the fly?