jsmrtn / craftagram

Grab Instagram content through the Instagram Basic Display API
Other
14 stars 8 forks source link

[FR] Request caching #19

Closed strandofgenius closed 3 years ago

strandofgenius commented 4 years ago

I wondered if using {% cache %} tag can help with the rate limit? If not is there a chance a feature request could be added to set a value in the admin or something to cache the request for x amount of time?

jsmrtn commented 4 years ago

@strandofgenius Yes it would help with rate limiting–the cache tag would cache the output of the craftagram call, so it wouldn't need to make calls to the controller every time, it would just request the existing record from the database.

gjhead commented 4 years ago

Curious - if using the {% cache %} tag on this, would it start before or directly after the {% set craftagram = craft.craftagram.getInstagramFeed(10) %} line?

jsmrtn commented 4 years ago

@gjhead As I understand it, the cache tag would start before the craftagram query.

jsmrtn commented 3 years ago

I've given this some thought, and don't think this is something we'll include in the plugin. The output of the call can be cached either natively with Craft or with a static page cache (either of which any optimised site should be utilising, in our opinion), so making the plugin cache the response too seems redundant.