UNPKG

strapi-pfapi

Version:

a strapi plugin library uses local and redis caches to achieve single digit milliseconds on average api response time.

10 lines (7 loc) 332 B
'use strict'; module.exports = (created_time, duration, count = 1, slow_duration = 1000) => { const duration_factor = duration ? duration / slow_duration : 1; const age_ms = (Date.now() - created_time) || 1000; const usage_factor = count / age_ms * 1000; return duration_factor * duration_factor * usage_factor; }