Saving data accross API's in Gramex

44 Views Asked by At

I am calling the same database query in multiple form handlers, I want to access the data once for processing and store it to use them across multiple form handlers.

1

There are 1 best solutions below

0
On

Formhandler, caches the data after your first query so essentially you are not querying to the DB if your query remains same.

And if you are firing the same query through multiple formhandlers you could essentially write a transform function which can do all the different processing after fetching the data (Formhandler will take care of caching and you will not query from different patterns).

/dataapi?mode=getsalesdata&otherparams=.......
/dataapi?mode=getavgsales&otherparams=........

You could also use query function in formhandler to control the dynamic behaviour of your query.

Provide some more details around the use-case to have a tailored response.