generic cache for javascript