VENTAS: 1-800-867-1389

 none
Refresh Cache on schedule

    Pregunta

  • I am very new to Azure, and am using the free account for MSDN subscribers. I want to have a single service which will run constantly (I think I can run a "small" instance 24/7 with the free hours).

    The service will download data from an external resource, format it nicely, and then provide that to my application when it requests it. But I need this to be VERY low latency. So I don't want to use the usual way of caching where when there is a request it check if the cache is expired and reloads it - I want the cache to always be up to date.

    So is it possible that I can give it a method to run every time any cached object expires (regardless of whether there is an app requesting this) where I will update it?

    Also, I see that data coming in is not metered, so constantly refreshing the cache from an external resource should be fine. It's a small amount anyway, and only every 10 minutes or so.

    Thanks!

    viernes, 13 de abril de 2012 23:25

Respuestas

  • Hi,

    Yes, but no need two hosted service in Windows Azure Mangement Portal, just deploy it as a work role in cloud application, but i do not think it's a good choice to do that, because if your application will be accessed frequently, the requests will be nearly in the same time, it's may not works as experts. But it's not so frequent, you can have a try.

    Hope this helps.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    sábado, 14 de abril de 2012 11:04
    Moderador

Todas las respuestas

  • Hi,

    As far as i know, i think Cache is useful for something was accessed frequently, so i do not think everything is fit Cache, and Azure Caching service maxinum is 4GB. If the cache onject is expired, the first request will be redirected to the original address for new data, and Caching service will help to save the "new version" of data, the following request can aslo get them from Caching service.

    If you still want to use your own handlers to management cache, try to set caching service expire time as a fixed value (such as 10 minutes in your situation), create a WorkRole and execute every 10 minutes (expire interval time) to update data with Azure Caching service. This workroke is the back-end application running the cloud.

    More details about how to work with Azure Caching service:

    http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_buildingappswithcacheservice_topic4#_Toc310505084

    Hope this helps.  


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    sábado, 14 de abril de 2012 7:21
    Moderador
  • Ok so I hope I am understanding correctly: I will run a WorkRole which will have a sleep of 10 minutes, and every 10 minutes it will download the new data and replace it in the cache. And then as a seperate WebRole I will have my actual webservice which will give that cached data to an app that calls it?

    If that is correct, then I have one more question:

    Do I setup two seperate "hosted services", one being the WorkRole, and the other being the WebRole? And if I write to cache in the one, will the other be able to read it by default?

    Thanks!

    sábado, 14 de abril de 2012 9:46
  • Hi,

    Yes, but no need two hosted service in Windows Azure Mangement Portal, just deploy it as a work role in cloud application, but i do not think it's a good choice to do that, because if your application will be accessed frequently, the requests will be nearly in the same time, it's may not works as experts. But it's not so frequent, you can have a try.

    Hope this helps.


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    sábado, 14 de abril de 2012 11:04
    Moderador