Hi team

I've created a custom module that has a controller that return a json,
but i would like to set 2 cache for two days,

Could that be posible?
Could you please help me?

Regards
Mario

Comments

wombatbuddy’s picture

See A simple example Drupal Controller with a cached JSON Response. 
But keep in mind that max-age does not work for anonymous users (for more details read Cache max-age).

jaypan’s picture

That's a nice example.

Contact me to contract me for D7 -> D10/11 migrations.

mxr10_’s picture

thank you that help me