         callback(error)
 
     handleProcessErrors(apmProcess, errorMessage, callback)
+
+  clearOutdatedCache: ->
+    @apmCache.loadOutdated =
+      value: null
+      expiry: 0
 
   loadPackage: (packageName, callback) ->
     args = ['view', packageName, '--json']

    Q.nbind(@loadFeatured, this, !!loadThemes)()

  getOutdated: ->
    Q.nbind(@loadOutdated, this)()

  getPackage: (packageName) ->
    @packagePromises[packageName] ?= Q.nbind(@loadPackage, this, packageName)()


module.exports =
class PackageManager
  # Millisecond expiry for cached loadOutdated, etc. values
  CACHE_EXPIRY: 1000*60*10

  constructor: ->
    @packagePromises = []
    @availablePackageCache = null
    @apmCache =
      loadOutdated:
        value: null
        expiry: 0

    @emitter = new Emitter

  getClient: ->
