1 Reply Latest reply on Dec 20, 2013 10:57 AM by Wolf-Dieter Fink

    Cache entry refresh after a timeout

    jan29 Newbie

      I'm currently working on an application using Infinispan 5.1.5 where I want to cache the results from a remote API. The cached values are fairly static, but should be updated every few minutes. I've had a look at using cache expiration to achieve this, but unless I'm mistaken, expired values are removed from the cache. If the remote API is unavailable for some reason, then any subsequent calls would encounter an error. For the application I'm working on, it is better to return (potentially) stale data than to return no data at all. Is it somehow possible to trigger a refresh of an entry from a CacheLoader after a (recurring) timeout instead of removing this entry? I know a few other cache implementations do have this option, but have been unable to find anything about this in the Infinispan documentation.

        • 1. Re: Cache entry refresh after a timeout
          Wolf-Dieter Fink Master

          In that case you need some kind of a double caching. I don't think that this is current possible.

          From the cache perspective you need to have a soft expiration like "if expired try to refresh from datastore, if fail use the expired value again for X times"

           

          That sound to me that you need a business logic in front, i.e. a REST service which do this job.

           

          But I think this is a cool feature and you might open a enhancement request for that