On Nov 17, 2015, at 8:37 AM, noah.p...@storyworldwide.com wrote:
To what extent does loopback cache responses, if at all? I couldn't find any documentation that speaks to this, but it seems like there is some caching of model relations as evidence by the__cachedRelations property.If there is no internal caching, what are some recommended approaches to implementing caching?
--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/6d074c83-efd4-4d5a-a77e-2139892c2505%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
var getCacheKey = function( ctx ){ return new Buffer( ctx.req.url + JSON.stringify( ctx.req.remotingContext.args ) ).toString('base64');}
remotes.before('*.__get__', function(ctx, next) { var key = getCacheKey( ctx ); if( memoryCache.get( key ) ) { var result = memoryCache.get( key ); ctx.res.status( ctx.res.statusCode ).send( result ); } else { next(); }});