Purge by Item Cache
I would suggest to let purge the cache of a particular item. I know that there is a button on the admin section of the plugin, but a per item one wold be useful when just want to update de price of one of them (for an offer, for example).
Would it be too difficult to develop?
Can I help you?
Thanks in advance.
I guess you would want something automatic, rather than manually flushing just the prices?
Something you can currently do with the plugin is to turn off ‘Live Data’ in the options page, then when you insert a product into a post it populates the shortcode with data fetched at the time of insertion. Then just need to delete items from the shortcode that you want to be fetched ‘live’ and add the option ‘live=1’ to the shortcode.
A completely live link, all data fetched on cache refresh:
A completely static link, all data provided in shortcode:
[amazon asin=B006O6FGTE&template=wishlist&title=Barbie Dolls of the World W3374 Mexico Doll - Pink Label Collection&artist=Mattel&manufacturer=Mattel&thumb=http://ecx.images-amazon.com/images/I/51vVrSgebbL._SL160_.jpg&rank=92424&rating=-&price=£20.89&live=0]
A partially static link, all but price provided in shortcode, ‘price’ is fetched on cache refresh – set cache age to 2 hours:
[amazon asin=B006O6FGTE&template=wishlist&title=Barbie Dolls of the World W3374 Mexico Doll - Pink Label Collection&artist=Mattel&manufacturer=Mattel&thumb=http://ecx.images-amazon.com/images/I/51vVrSgebbL._SL160_.jpg&rank=92424&rating=-&live=1]
Obvious problems with this are:
- Harder to put links in the posts in the first place
- Localised data is not provided
- Changes to product details are not picked up (do they ever change?)
- Changing the template content (e.g. adding a new keyword) will be missing from all your shortcodes
As for making this a new feature of the plugin…
- Always exclude price data from the cache, so it is fetched on every page view – probably too slow.
- A background task that refreshes the price data in all cached items every few hours – feasible, but a bit limited
- Split the cache into ‘Permanent’ data and ‘Live’ data, the ‘Live’ data is fetched more frequently – perhaps ultimately making the ‘Permanent’ data an editable database – probably the way I’d like to go but quiet a major change in functionality
Needs some thought!
My idea comes from something I saw in another Amazon plugin before using yours.
In that plugin (I don’t remember the name) shows on the admin page a list of the ASIN cached and next to it a button for purging that ASIN.
My real problem were that I seen a price drop on Amazon and when I reviewed the same product on my web I saw that I wasn’t updated. So I went to look for a partial purge for that ASIN.
Currently I have reduced the purge time from 48 to 2 hours, so my problem is partially resolved. Of course your 3rd solution sounds really good, but it looks really hard to develop and it does’t resolve the big amount of queries to Amazon that I understand that is the original idea for the cache, ¿right?
What do you think about the solution of listing each ASIN to individually purging if needed? If I understand you it’s as easy as putting it to live=1, querying amazon for that ASIN, and setting it to live=0 again, isn’t it?
Many thanks again!
I could probably add an extension that allows you to purge individual items, but it would be the whole item not just the price (but it ‘costs’ [in terms of delay to page loading] as much to retrieve all the item details as it does to just get the price).
Unfortunately turning live on and off does not cause the plugin to flush the item from the cache it just stops it even looking in the cache for the items data.
Let me know if a ‘cache manager’ would be useful and I could probably knock one together in a few days.
If it’s not too much work, the “Cache Manager” extension for purging individual items (the whole item is fine for me) would be grate for me. But I really don’t know if it would be useful for someone else.
Currently I have mitigated my problem with the 2 hours cache refresh.
Thanks again for everything.
Very early version of cache manager plugin, install in your plugins directory and activate in plugins manager:
http://bit.ly/18GSCRo (link valid until 16th August).
Really need to add pagination of cache entries and a search facility…
Thanks for your work! I have installed this, but I don’t know what is expected to see and where. I’m sorry, probably I’m missing something obvious.
Sorry just for some reason I thought you were using the development version of the plugin. The cache manager only works with that version, sorry!
You can try it out if you want, it can be downloaded from:
- The topic ‘Purge by Item Cache’ is closed to new replies.