Skip to content

Instantly share code, notes, and snippets.

@pubudu91
Last active June 29, 2018 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pubudu91/62cc3a8d21b2dc8c6c5cfd1925ffa47a to your computer and use it in GitHub Desktop.
Save pubudu91/62cc3a8d21b2dc8c6c5cfd1925ffa47a to your computer and use it in GitHub Desktop.
import ballerina/http;
endpoint http:Client cachingEP {
url: "https://jigsaw.w3.org/",
cache: {
isShared: true
}
};
@http:ServiceConfig {
basePath: "/cache"
}
service<http:Service> cachingService bind { port: 9090 } {
@http:ResourceConfig {
path: "/"
}
cacheableResource(endpoint caller, http:Request req) {
http:Response response = check cachingEP->get("/HTTP/cc.html");
_ = caller->respond(response);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment