2

Does the services module always invoke php to return data in json format? Is there anyway to cache the json output to be served for anonymous users (i.e. retrieve json data without invoking php)? First request will hit php and all subsequent hits should hit the cache.

My endpoint looks like this api/anon and it does not have any session authentication.

My request looks like this http://localhost/api/anon/node/[nid]

Thanks

3 Answers 3

3

Even in my experience, the boost module doesn't seem to cache responses from the Services module end points the last time I tried. But here's a discussion on this topic in the module's issue tracker. There's a patch for this requirement http://drupal.org/node/1219484

1

I feel like something such as Varnish would be more suited to this than trying to do it all in Drupal. The stock varnish configuration does a pretty good job at caching content that the backend says is safe to cache.

0

For json response use rest server.

For static cache use boost module, for caching responses as static pages.

3
  • Unfortunately boost doesn't recognize the json path that comes from services. I want to know a smart to tell services to cache json output if "session authentication" in unchecked.
    – Minty
    May 9, 2012 at 10:33
  • Yes it does, please check your boost settings including htaccess update. On boost settings you have to enable json extension.
    – ropic
    May 9, 2012 at 17:17
  • Yes I have already done stuff you mentioned. But I always get the headers as "X-Drupal-Cache : Miss". Not sure if this is a bug from services module.
    – Minty
    May 9, 2012 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.