jkaye2012/polling-cache

I'm a little confused

jonathanfishbein1 opened this issue · 5 comments

I'm only seeing it run once?

Could you show how you're using the cache and what output you're seeing? There are test cases for this behavior and I was able to confirm that the library is working for me locally.

main :: Relude.IO () main = do let opts = Data.Cache.Polling.basicOptions (Data.Cache.Poling.DelayForMicroseconds 100000) Data.Cache.Polling.Ignore cache <- Data.Cache.Polling.newPollingCache opts (Relude.return 1) Control.Concurrent.threadDelay 100 latestResult <- Data.Cache.Polling.Cache.cachedValue cache Relude.print latestResult

cabal runs and then exists

Ok I see you have to call cachedValue multiple times to poll

So, to be specific, the library will poll regardless of calls to cachedValue. The exiting behavior is because there's nothing in that program that tells cabal to keep running (or, rather, not to exit).

You would need to call cachedValue multiple times to see values as they change though!

I'm going to close this for now since it doesn't appear to be an issue with the library, but please feel free to ask further questions here if you have them.