I am using google places API to automatically fill some fields in Umbraco CMS on SAVE. Here's how it works: I enter place ID manually and then on SAVE I use that placeID to call external google API (in Umbraco onSave event) and automatically fill other fields (name, location, contact etc). Problem is, it seems that Umbraco is caching the results from the first call and when I try to create more nodes in one session it fills the same information for every one of them no matter that the place ID is DIFFERENT.
When I log out and then log in again, first call is OK again and then other are cached (I assume).
Please help. Is this really a problem with the cache and if so how can I change it?? If you need more details please comment I will send everything that is needed.
I managed to solve it when run locally. I had a class which inherited from ApplicationEventHandler (public class onSaved : ApplicationEventHandler) where I had few private properties. What I didn't realize was that once I set the values of these properties they remain for the whole session. So I solved the problem by setting them to null at the end of every onSaved iteration.
Umbraco caching problem
Hi everyone
I am using google places API to automatically fill some fields in Umbraco CMS on SAVE. Here's how it works: I enter place ID manually and then on SAVE I use that placeID to call external google API (in Umbraco onSave event) and automatically fill other fields (name, location, contact etc). Problem is, it seems that Umbraco is caching the results from the first call and when I try to create more nodes in one session it fills the same information for every one of them no matter that the place ID is DIFFERENT. When I log out and then log in again, first call is OK again and then other are cached (I assume). Please help. Is this really a problem with the cache and if so how can I change it?? If you need more details please comment I will send everything that is needed.
Thanks
Also, forgot to mention, my website is hosted on VPS Windows Server 2008 R2, IIS 7, maybe that's where the problem and caching is.
Hi Kevin,
Can you show how you are a) calling the Google API, and b) how you are populating the content fields in the save event?
Seeing some code might help us see what's going on but I wouldn't have expected Umbraco to be caching your custom API requests to Google.
Is this happening locally or on a live environment?
Cheers
Nik
I managed to solve it when run locally. I had a class which inherited from ApplicationEventHandler (public class onSaved : ApplicationEventHandler) where I had few private properties. What I didn't realize was that once I set the values of these properties they remain for the whole session. So I solved the problem by setting them to null at the end of every onSaved iteration.
Thanks for the comment Nik, really appreciate it.
is working on a reply...