Caching
Caching
Caching of server responses is a good web practice and we strongly recommend and support caching our data. In Roanuz Cricket API, every response comes with a Cache object. It aids in the storing and retrieving of the corresponding responses.
The Cache Object
The Cache object contains a set of instructions and recommendations that will help you with the caching of data and handling of the cache internally.
The cache object contains four properties:
cache.key cache.expires cache.max_age cache.etag
cache.key cache.expires cache.max_age cache.etag
Cache Key
The cache.key is the key we recommend to be used for caching. You can use it while you cache a response of that API.
Maximum Cache Validity
The cache.max_age gives away the time the data from a response can be considered to be fresh. It gives you a heads up on when you should be checking for updates in the data.
The cache.expires time will always be longer than the cache.max_age time. The cache.expires you how long you can cache the data while the cache.max_age tells you when you should be checking for updates.
Etag
The cache.etag helps you implement the HTTP Etag mechanism.
The ETag HTTP response header is an identifier for a specific version of a server response. It helps in efficient caching and saves considerable bandwidth, as if the content has not changed between two requests, the server does not have to resend a full response. In most responses, the cache.identifier and cache.etag values will be the same.
The HTTP caching process, if implemented properly, can result in a lot of bandwidth savings. We, at Roanuz, have always been recommending and providing support for caching keeping your best interests in mind.