The current implementation is enabled by setting the geostream.cache to a path on disk where the files are stored. Calls to api.Geostreams.binDatapoints(...) and api.Geostreams.searchDatapoints(...) will use cacheFetch() to retrieve the response from the cache if available or create it, put it in the cache and then return it. The files on disk are stored by hashing the request. Two files are stored on disk under the hash, the response as a json text file (without spaces) and a .json file that includes the actual request as json (for inspection of the raw files). For example:
Here are two example queries from a .json file:
{"format":"json","operator":"","since":"","until":"","geocode":"","stream_id":"7196","sensor_id":"","sources":[],"attributes":[],"semi":""} {"time":"season","depth":1.0,"since":"","until":"","geocode":"","stream_id":"","sensor_id":"844","sources":[],"attributes":[]} |
Here is an example of the response:
{"sensor_name":"grid0713","properties":{"species":[],"toxaphene_var":[ {"depth":0.0,"label":"1991 winter","sources":["http://seagrant-dev.ncsa.illinois.edu/medici/datasets/54591ee1e4b0e9dff1baf336"],"year":1991,"date":"1991-02-01T12:00:00.000-06:00","depth_code":"NA","average":0.0477260702109212,"count":1}, {"depth":0.0,"label":"1991 spring","sources":["http://seagrant-dev.ncsa.illinois.edu/medici/datasets/54591ee1e4b0e9dff1baf336"],"year":1991,"date":"1991-05-01T12:00:00.000-05:00","depth_code":"NA","average":0.0477260702109212,"count":1}, {"depth":0.0,"label":"1991 summer","sources":["http://seagrant-dev.ncsa.illinois.edu/medici/datasets/54591ee1e4b0e9dff1baf336"],"year":1991,"date":"1991-08-01T12:00:00.000-05:00","depth_code":"NA","average":0.0477260702109212,"count":1}, {"depth":0.0,"label":"1991 fall","sources":["http://seagrant-dev.ncsa.illinois.edu/medici/datasets/54591ee1e4b0e9dff1baf336"],"year":1991,"date":"1991-11-01T12:00:00.000-06:00","depth_code":"NA","average":0.0477260702109212,"count":1}, {"depth":0.0,"label":"1993 winter","sources":["http://seagrant-dev.ncsa.illinois.edu/medici/datasets/54591ee1e4b0e9dff1baf336"],"year":1993,"date":"1993-02-01T12:00:00.000-06:00","depth_code":"NA","average":0.139673763930734,"count":1}, {"depth":0.0,"label":"1993 spring","sources":["http://seagrant-dev.ncsa.illinois.edu/medici/datasets/54591ee1e4b0e9dff1baf336"],"year":1993,"date":"1993-05-01T12:00:00.000-05:00","depth_code":"NA","average":0.139673763930734,"count":1}, {"depth":0.0,"label":"1993 summer","sources":["http://seagrant-dev.ncsa.illinois.edu/medici/datasets/54591ee1e4b0e9dff1baf336"],"year":1993,"date":"1993-08-01T12:00:00.000-05:00","depth_code":"NA","average":0.139673763930734,"count":1} |
Current potential issues: