Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevin C. Halpin 27 posts 108 karma points
    Aug 09, 2018 @ 10:08
    Kevin C. Halpin
    0

    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

  • Kevin C. Halpin 27 posts 108 karma points
    Aug 09, 2018 @ 10:26
    Kevin C. Halpin
    0

    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.

  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Aug 09, 2018 @ 11:02
    Nik
    101

    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

  • Kevin C. Halpin 27 posts 108 karma points
    Aug 09, 2018 @ 20:12
    Kevin C. Halpin
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft