play-ws | Standalone Play WS , an async HTTP client with fluent API | Reactive Programming library
kandi X-RAY | play-ws Summary
kandi X-RAY | play-ws Summary
Play WS is a powerful HTTP Client library, originally developed by the Play team for use with Play Framework. It uses AsyncHttpClient for HTTP client functionality and has no Play dependencies. We've provided some documentation here on how to use Play WS in your app (without Play). For more information on how to use Play WS in Play, please refer to the Play documentation.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of play-ws
play-ws Key Features
play-ws Examples and Code Snippets
Community Discussions
Trending Discussions on play-ws
QUESTION
I'm using Caffeine cache implementation with my java Play Framework job to cache outgoing http requests, and I see that in spite of the fact that the cache is up and running, my service still hit the external server every time instead of returning the value from the cache. And I see that the key logged in the logs is always the same.
So I see freshnessLifetime
is not set, so it might mean that the cache expires immediately. but I still don't know how to set it in the config
I have not changed my java code and I cannot find any examples if I need to do that, or I'm only supposed to have a config for cache working for all outgoing requests.
I would appreciate any help with this
My build.sbt
contains:
ANSWER
Answered 2020-Oct-02 at 00:51I actually found how it works. The cache is not supposed to manage the lifetime like it does a separate service like Redis or Memcached but instead it acts like a browser does and is managed by the headers in HTTP response. Here: https://github.com/playframework/cachecontrol/blob/e4694aa0665e2ccc5030ae1cf1d0b15ad5b98471/src/main/scala/com/typesafe/play/cachecontrol/FreshnessCalculator.scala#L42
So the solution for me was to change the server so it serves correct header: Cache-Control "max-age=3600, public"
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install play-ws
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page