I am hoping that I can receive some pointers on how I would implement a 
cache within a flow.  An example goal would be to be given a list of URLs 
and to provide statistics on the content of each of those URLs.  However 
due to bandwidth constraints, I only want to refresh from the last set of 
known URLs every 30 minutes.  So use the value from the cache if it is less 
than 30 minutes old otherwise to refresh from the website.

val f = Source.single("http://example.com";)
.via(fetchContentFromWebsite)
.runFold(BigDecimal("0"))((totalSalaries, contentOption) => contentOption.
fold(totalSalaries)(content => totalSalaries + content.salary))


I know I could just implement a cache within the "fetchContentFromWebsite" 
flow (within its map function) but that doesn't seem right to me.  I have 
looked into FlexiMerge but it appears to hit both inputs regardless.  I 
guess I am looking for a way to implement a conditional flow: use value 
from cache otherwise use value from website.

Thanks,
Seamus

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to