                 index = _.sortedIndex _tasks, task, (task) -> task.order
                 _tasks.splice index, 0, task
 
+                # invalid cache
+                _invalidCache task
+
                 @emit 'change'
 
         handle ActionTypes.SET_REINDEX_STATE, (isReindexing) ->

            # adds the task to the cid index
            _tasksByCid[rawTask.cid] = rawTask

            @emit 'change'

        handle ActionTypes.REMOVE_TASK, (task) ->


        return {tasksList, tasksListByCid}

    # invalid all cached lists if they contain the task
    _invalidCache = (task) ->
        tags = task.tags
        cacheKeys = Object.keys _cache
        for cacheKey in cacheKeys
            i = 0
            while i < tags.length and cacheKey.indexOf(tags[i]) is -1
                i++

            # invalidate the cache if the task is in it
            if cacheKey.indexOf(tags[i]) isnt -1
                delete _cache[cacheKey]

    __bindHandlers: (handle) ->
        handle ActionTypes.CREATE_TASK, (payload) ->
            {nextIndex, rawTask} = payload
