Caching is specifically covered in the Instagram API Terms of Use:
2. You shall not:
...
Cache or store any User Content other than for reasonable periods
in order to provide the service you are providing to Instagram users.
So yes, it would appear legal to cache content provided it is for a reasonable period for performance purposes.
Caveat: IANAL