 
   all: (cb=->) ->
     if @_single
-      fs.readFile @_getFileName(), "utf8", (err, content) ->
-        return cb err if err?
-        try
-          cb null, JSON.parse content
-        catch e
-          cb e
+      getObjectFromFile.call @, undefined, cb
     else
       readIDs @_dir, (err, ids) =>
         return cb err if err?

     console.error e
     cb e

id2fileName = (id, dir) -> path.join dir,"#{id}.json"

save = (id, o, cb) ->

  if @_single
    backup = @_cache[id]
    delete @_cache[id]
    done = (err)=>
      if err?
        @_cache[id] = backup
        if cb? then cb err else err
      else cb? null
    if cb?
      saveObjectToFile @_cache, file, done
    else
      err = (o = saveObjectToFile @_cache, file) instanceof Error
      done err, o
  else
    done = (err) =>
      return (if cb? cb err else err) if err?
