'invalidates either this whole cache, a single entry or a list of
entries in this cache
:param key:
the key of the entry to invalidate; if None, the entire cache
will be invalidated'

def invalidate(self, key=None):

    def _invalidate(key):
        try:
            self._objects[key] = _invalid_object
        except:
            print 'error    occurred    while    invalidating    {0}'.format(key)
            traceback.print_exc()
    with self._write_lock:
        if (key is None):
            for k in self._objects.keys():
                _invalidate(k)
        elif isinstance(key, strbase):
            _invalidate(key)
        else:
            for k in key:
                _invalidate(k)
    self._schedule_save()
